Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Side by Side Diff: state/apiserver/apiserver.go

Issue 8626043: juju: remove dependency on api/params
Patch Set: juju: remove dependency on api/params Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 package apiserver 1 package apiserver
2 2
3 import ( 3 import (
4 "code.google.com/p/go.net/websocket" 4 "code.google.com/p/go.net/websocket"
5 "fmt" 5 "fmt"
6 "launchpad.net/juju-core/charm" 6 "launchpad.net/juju-core/charm"
7 "launchpad.net/juju-core/juju" 7 "launchpad.net/juju-core/juju"
8 "launchpad.net/juju-core/log" 8 "launchpad.net/juju-core/log"
9 "launchpad.net/juju-core/state" 9 "launchpad.net/juju-core/state"
10 "launchpad.net/juju-core/state/api" 10 "launchpad.net/juju-core/state/api"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 Deltas: deltas, 278 Deltas: deltas,
279 }, err 279 }, err
280 } 280 }
281 281
282 func (aw srvClientAllWatcher) Stop() error { 282 func (aw srvClientAllWatcher) Stop() error {
283 return aw.w.(*multiwatcher.Watcher).Stop() 283 return aw.w.(*multiwatcher.Watcher).Stop()
284 } 284 }
285 285
286 // ServiceSet implements the server side of Client.ServerSet. 286 // ServiceSet implements the server side of Client.ServerSet.
287 func (c *srvClient) ServiceSet(p params.ServiceSet) error { 287 func (c *srvClient) ServiceSet(p params.ServiceSet) error {
288 » return juju.ServiceSet(c.root.srv.state, p) 288 » svc, err := c.root.srv.state.Service(p.ServiceName)
289 » if err != nil {
290 » » return err
291 » }
292 » return svc.Set(p.Options)
289 } 293 }
290 294
291 // ServiceSetYAML implements the server side of Client.ServerSetYAML. 295 // ServiceSetYAML implements the server side of Client.ServerSetYAML.
292 func (c *srvClient) ServiceSetYAML(p params.ServiceSetYAML) error { 296 func (c *srvClient) ServiceSetYAML(p params.ServiceSetYAML) error {
293 » return juju.ServiceSetYAML(c.root.srv.state, p) 297 » svc, err := c.root.srv.state.Service(p.ServiceName)
298 » if err != nil {
299 » » return err
300 » }
301 » return svc.SetYAML([]byte(p.Config))
294 } 302 }
295 303
296 // ServiceGet returns the configuration for a service. 304 // ServiceGet returns the configuration for a service.
297 func (c *srvClient) ServiceGet(args params.ServiceGet) (params.ServiceGetResults , error) { 305 func (c *srvClient) ServiceGet(args params.ServiceGet) (params.ServiceGetResults , error) {
298 return statecmd.ServiceGet(c.root.srv.state, args) 306 return statecmd.ServiceGet(c.root.srv.state, args)
299 } 307 }
300 308
301 // Resolved implements the server side of Client.Resolved. 309 // Resolved implements the server side of Client.Resolved.
302 func (c *srvClient) Resolved(p params.Resolved) error { 310 func (c *srvClient) Resolved(p params.Resolved) error {
303 » return statecmd.Resolved(c.root.srv.state, p) 311 » unit, err := c.root.srv.state.Unit(p.UnitName)
312 » if err != nil {
313 » » return err
314 » }
315 » return unit.Resolve(p.Retry)
304 } 316 }
305 317
306 // ServiceExpose changes the juju-managed firewall to expose any ports that 318 // ServiceExpose changes the juju-managed firewall to expose any ports that
307 // were also explicitly marked by units as open. 319 // were also explicitly marked by units as open.
308 func (c *srvClient) ServiceExpose(args params.ServiceExpose) error { 320 func (c *srvClient) ServiceExpose(args params.ServiceExpose) error {
309 return statecmd.ServiceExpose(c.root.srv.state, args) 321 return statecmd.ServiceExpose(c.root.srv.state, args)
310 } 322 }
311 323
312 // ServiceUnexpose changes the juju-managed firewall to unexpose any ports that 324 // ServiceUnexpose changes the juju-managed firewall to unexpose any ports that
313 // were also explicitly marked by units as open. 325 // were also explicitly marked by units as open.
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 func (ws *watchers) stopAll() { 668 func (ws *watchers) stopAll() {
657 ws.mu.Lock() 669 ws.mu.Lock()
658 defer ws.mu.Unlock() 670 defer ws.mu.Unlock()
659 for _, w := range ws.ws { 671 for _, w := range ws.ws {
660 if err := w.w.Stop(); err != nil { 672 if err := w.w.Stop(); err != nil {
661 log.Errorf("state/api: error stopping %T watcher: %v", w , err) 673 log.Errorf("state/api: error stopping %T watcher: %v", w , err)
662 } 674 }
663 } 675 }
664 ws.ws = make(map[string]*srvWatcher) 676 ws.ws = make(map[string]*srvWatcher)
665 } 677 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b