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

Delta Between Two Patch Sets: state/state.go

Issue 6203083: jujud: add primordial provisioning agent (Closed)
Left Patch Set: jujud: add primordial provisioning agent Created 12 years, 10 months ago
Right Patch Set: jujud: add primordial provisioning agent Created 12 years, 10 months 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « cmd/jujud/provisioning.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // The state package enables reading, observing, and changing 1 // The state package enables reading, observing, and changing
2 // the state stored in ZooKeeper of a whole environment 2 // the state stored in ZooKeeper of a whole environment
3 // managed by juju. 3 // managed by juju.
4 package state 4 package state
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 "launchpad.net/goyaml" 8 "launchpad.net/goyaml"
9 "launchpad.net/gozk/zookeeper" 9 "launchpad.net/gozk/zookeeper"
10 "launchpad.net/juju/go/charm" 10 "launchpad.net/juju/go/charm"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 for _, key := range topology.MachineKeys() { 96 for _, key := range topology.MachineKeys() {
97 machines = append(machines, &Machine{s, key}) 97 machines = append(machines, &Machine{s, key})
98 } 98 }
99 return machines, nil 99 return machines, nil
100 } 100 }
101 101
102 // AddCharm adds the ch charm with curl to the state. 102 // AddCharm adds the ch charm with curl to the state.
103 // bundleUrl must be set to a URL where the bundle for ch 103 // bundleUrl must be set to a URL where the bundle for ch
104 // may be downloaded from. 104 // may be downloaded from.
105 // On success the newly added charm state is returned. 105 // On success the newly added charm state is returned.
106 func (s *State) AddCharm(ch charm.Charm, curl *charm.URL, bundleURL *url.URL) (* Charm, error) { 106 func (s *State) AddCharm(ch charm.Charm, curl *charm.URL, bundleURL *url.URL, bu ndleSha256 string) (*Charm, error) {
107 data := &charmData{ 107 data := &charmData{
108 » » Meta: ch.Meta(), 108 » » Meta: ch.Meta(),
109 » » Config: ch.Config(), 109 » » Config: ch.Config(),
110 » » BundleURL: bundleURL.String(), 110 » » BundleURL: bundleURL.String(),
111 » » BundleSha256: bundleSha256,
111 } 112 }
112 yaml, err := goyaml.Marshal(data) 113 yaml, err := goyaml.Marshal(data)
113 if err != nil { 114 if err != nil {
114 return nil, err 115 return nil, err
115 } 116 }
116 path, err := charmPath(curl) 117 path, err := charmPath(curl)
117 if err != nil { 118 if err != nil {
118 return nil, err 119 return nil, err
119 } 120 }
120 _, err = s.zk.Create(path, string(yaml), 0, zkPermAll) 121 _, err = s.zk.Create(path, string(yaml), 0, zkPermAll)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 serviceName, _, err := parseUnitName(name) 242 serviceName, _, err := parseUnitName(name)
242 if err != nil { 243 if err != nil {
243 return nil, err 244 return nil, err
244 } 245 }
245 service, err := s.Service(serviceName) 246 service, err := s.Service(serviceName)
246 if err != nil { 247 if err != nil {
247 return nil, err 248 return nil, err
248 } 249 }
249 return service.Unit(name) 250 return service.Unit(name)
250 } 251 }
252
253 // Environment returns the *ConfigNode representing this environments
254 // configuration
255 func (s *State) Environment() *ConfigNode {
256 return newConfigNode(s.zk, zkEnvironmentPath)
257 }·······
LEFTRIGHT

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