Merge lp:~wallyworld/juju-core/agent-conf-upgradedto into lp:~go-bot/juju-core/trunk

Proposed by Ian Booth
Status: Merged
Approved by: Ian Booth
Approved revision: no longer in the source branch.
Merged at revision: 2359
Proposed branch: lp:~wallyworld/juju-core/agent-conf-upgradedto
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 948 lines (+338/-206)
14 files modified
agent/agent.go (+71/-41)
agent/agent_test.go (+122/-78)
agent/bootstrap_test.go (+12/-10)
agent/format-1.12_whitebox_test.go (+3/-0)
agent/format-1.16.go (+35/-18)
agent/format-1.16_whitebox_test.go (+25/-1)
agent/format_whitebox_test.go (+8/-6)
cmd/jujud/agent_test.go (+16/-14)
cmd/jujud/bootstrap_test.go (+9/-7)
environs/cloudinit/cloudinit.go (+10/-8)
juju/testing/conn.go (+8/-7)
worker/deployer/simple.go (+5/-4)
worker/provisioner/kvm-broker_test.go (+7/-6)
worker/provisioner/lxc-broker_test.go (+7/-6)
To merge this branch: bzr merge lp:~wallyworld/juju-core/agent-conf-upgradedto
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+207600@code.launchpad.net

Commit message

Record upgradedToVersion in agent conf

The agent config files now record the version for
which upgrade steps were run. If there is no entry
in a config file, is is assumed the version is 1.16.
So there is no need for any migration, nor are there
compatibility issues. When 1.18 is deployed, the upgrade
steps are run and the config file will have 1.18 written
to it, allowing 1.20 to know that it is upgrding from
1.18 etc.

https://codereview.appspot.com/66870044/

Description of the change

Record upgradedToVersion in agent conf

The agent config files now record the version for
which upgrade steps were run. If there is no entry
in a config file, is is assumed the version is 1.16.
So there is no need for any migration, nor are there
compatibility issues. When 1.18 is deployed, the upgrade
steps are run and the config file will have 1.18 written
to it, allowing 1.20 to know that it is upgrding from
1.18 etc.

https://codereview.appspot.com/66870044/

To post a comment you must log in.
Revision history for this message
Ian Booth (wallyworld) wrote :

Reviewers: mp+207600_code.launchpad.net,

Message:
Please take a look.

Description:
Record upgradedToVersion in agent conf

The agent config files now record the version for
which upgrade steps were run. If there is no entry
in a config file, is is assumed the version is 1.16.
So there is no need for any migration, nor are there
compatibility issues. When 1.18 is deployed, the upgrade
steps are run and the config file will have 1.18 written
to it, allowing 1.20 to know that it is upgrding from
1.18 etc.

https://code.launchpad.net/~wallyworld/juju-core/agent-conf-upgradedto/+merge/207600

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/66870044/

Affected files (+332, -203 lines):
   A [revision details]
   M agent/agent.go
   M agent/agent_test.go
   M agent/bootstrap_test.go
   M agent/format-1.12_whitebox_test.go
   M agent/format-1.16.go
   M agent/format-1.16_whitebox_test.go
   M agent/format_whitebox_test.go
   M cmd/jujud/agent_test.go
   M cmd/jujud/bootstrap_test.go
   M environs/cloudinit/cloudinit.go
   M juju/testing/conn.go
   M worker/deployer/simple.go
   M worker/provisioner/kvm-broker_test.go
   M worker/provisioner/lxc-broker_test.go

Revision history for this message
Tim Penhey (thumper) wrote :

https://codereview.appspot.com/66870044/diff/1/agent/agent.go
File agent/agent.go (right):

https://codereview.appspot.com/66870044/diff/1/agent/agent.go#newcode412
agent/agent.go:412: return c.Write()
If c.Write fails we now have the wrong version stored locally.

Care to fix that?

https://codereview.appspot.com/66870044/diff/1/agent/agent_test.go
File agent/agent_test.go (right):

https://codereview.appspot.com/66870044/diff/1/agent/agent_test.go#newcode226
agent/agent_test.go:226: rereadCommands, err := c2.WriteCommands()
these variable names no longer make sense.

https://codereview.appspot.com/66870044/diff/1/agent/format-1.16.go
File agent/format-1.16.go (right):

https://codereview.appspot.com/66870044/diff/1/agent/format-1.16.go#newcode73
agent/format-1.16.go:73: if value != "" {
I find this much more complicated to follow than a version that doesn't
have named params:

func (*formatter_1_16) upgradedToVersion(value string) (version.Number,
error) {
     if value != "" {
         return version.Parse(value)
     }
     return version.MustParse("1.16.0"), nil
}

https://codereview.appspot.com/66870044/

Revision history for this message
Ian Booth (wallyworld) wrote :

Please take a look.

https://codereview.appspot.com/66870044/diff/1/agent/agent_test.go
File agent/agent_test.go (right):

https://codereview.appspot.com/66870044/diff/1/agent/agent_test.go#newcode226
agent/agent_test.go:226: rereadCommands, err := c2.WriteCommands()
On 2014/02/26 02:23:41, thumper wrote:
> these variable names no longer make sense.

Done.

https://codereview.appspot.com/66870044/diff/1/agent/format-1.16.go
File agent/format-1.16.go (right):

https://codereview.appspot.com/66870044/diff/1/agent/format-1.16.go#newcode73
agent/format-1.16.go:73: if value != "" {
On 2014/02/26 02:23:41, thumper wrote:
> I find this much more complicated to follow than a version that
doesn't have
> named params:

> func (*formatter_1_16) upgradedToVersion(value string)
(version.Number, error) {
> if value != "" {
> return version.Parse(value)
> }
> return version.MustParse("1.16.0"), nil
> }

Done.

https://codereview.appspot.com/66870044/

Revision history for this message
Ian Booth (wallyworld) wrote :

https://codereview.appspot.com/66870044/diff/1/agent/agent.go
File agent/agent.go (right):

https://codereview.appspot.com/66870044/diff/1/agent/agent.go#newcode412
agent/agent.go:412: return c.Write()
On 2014/02/26 02:23:41, thumper wrote:
> If c.Write fails we now have the wrong version stored locally.

> Care to fix that?

Done.

https://codereview.appspot.com/66870044/

Revision history for this message
Tim Penhey (thumper) wrote :
Revision history for this message
Tim Penhey (thumper) :
review: Approve
Revision history for this message
Go Bot (go-bot) wrote :
Download full text (9.6 KiB)

The attempt to merge lp:~wallyworld/juju-core/agent-conf-upgradedto into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.017s
ok launchpad.net/juju-core/agent 1.236s
ok launchpad.net/juju-core/agent/tools 0.257s
ok launchpad.net/juju-core/bzr 7.054s
ok launchpad.net/juju-core/cert 3.641s
ok launchpad.net/juju-core/charm 0.534s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.037s
ok launchpad.net/juju-core/cloudinit/sshinit 1.200s
ok launchpad.net/juju-core/cmd 0.202s
ok launchpad.net/juju-core/cmd/charm-admin 0.812s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/juju 252.830s
ok launchpad.net/juju-core/cmd/jujud 62.086s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 13.722s
? launchpad.net/juju-core/cmd/plugins/juju-restore [no test files]
ok launchpad.net/juju-core/constraints 0.027s
ok launchpad.net/juju-core/container 0.040s
ok launchpad.net/juju-core/container/factory 0.055s
ok launchpad.net/juju-core/container/kvm 0.254s
ok launchpad.net/juju-core/container/kvm/mock 0.039s
? launchpad.net/juju-core/container/kvm/testing [no test files]
ok launchpad.net/juju-core/container/lxc 0.304s
? launchpad.net/juju-core/container/lxc/mock [no test files]
? launchpad.net/juju-core/container/lxc/testing [no test files]
? launchpad.net/juju-core/container/testing [no test files]
ok launchpad.net/juju-core/downloader 5.305s
ok launchpad.net/juju-core/environs 3.213s
ok launchpad.net/juju-core/environs/bootstrap 4.695s
ok launchpad.net/juju-core/environs/cloudinit 0.649s
ok launchpad.net/juju-core/environs/config 2.194s
ok launchpad.net/juju-core/environs/configstore 0.049s
ok launchpad.net/juju-core/environs/filestorage 0.032s
ok launchpad.net/juju-core/environs/httpstorage 1.016s
ok launchpad.net/juju-core/environs/imagemetadata 0.608s
? launchpad.net/juju-core/environs/imagemetadata/testing [no test files]
ok launchpad.net/juju-core/environs/instances 0.061s
ok launchpad.net/juju-core/environs/jujutest 0.242s
ok launchpad.net/juju-core/environs/manual 15.725s
ok launchpad.net/juju-core/environs/simplestreams 0.389s
? launchpad.net/juju-core/environs/simplestreams/testing [no test files]
ok launchpad.net/juju-core/environs/sshstorage 1.184s
ok launchpad.net/juju-core/environs/storage 1.162s
ok launchpad.net/juju-core/environs/sync 36.513s
ok launchpad.net/juju-core/environs/testing 0.206s
ok launchpad.net/juju-core/environs/tools 6.740s
? launchpad.net/juju-core/environs/tools/testing [no test files]
ok launchpad.net/juju-core/errors 0.016s
ok launchpad.net/juju-core/instance 0.024s
? launchpad.net/juju-core/instance/testing [no test files]
ok launchpad.net/juju-core/juju 24.882s
ok launchpad.net/juju-core/juju/osenv 0.020s
? launchpad.net/juju-core/juju/testing [no test files]
ok launchpad.net/juju-core/log 0.015s
ok launchpad.net/juju-core/log/syslog 0.023s
? launchpad.net/juju-co...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'agent/agent.go'
--- agent/agent.go 2014-02-18 05:43:06 +0000
+++ agent/agent.go 2014-02-26 03:43:42 +0000
@@ -17,6 +17,7 @@
17 "launchpad.net/juju-core/state/api"17 "launchpad.net/juju-core/state/api"
18 "launchpad.net/juju-core/state/api/params"18 "launchpad.net/juju-core/state/api/params"
19 "launchpad.net/juju-core/utils"19 "launchpad.net/juju-core/utils"
20 "launchpad.net/juju-core/version"
20)21)
2122
22var logger = loggo.GetLogger("juju.agent")23var logger = loggo.GetLogger("juju.agent")
@@ -88,6 +89,14 @@
88 // APIServerDetails returns the details needed to run an API server.89 // APIServerDetails returns the details needed to run an API server.
89 APIServerDetails() (port int, cert, key []byte)90 APIServerDetails() (port int, cert, key []byte)
9091
92 // UpgradedToVersion returns the version for which all upgrade steps have been
93 // successfully run, which is also the same as the initially deployed version.
94 UpgradedToVersion() version.Number
95
96 // WriteUpgradedToVersion updates the config's UpgradedToVersion and writes
97 // the new agent configuration.
98 WriteUpgradedToVersion(newVersion version.Number) error
99
91 // Value returns the value associated with the key, or an empty string if100 // Value returns the value associated with the key, or an empty string if
92 // the key is not found.101 // the key is not found.
93 Value(key string) string102 Value(key string) string
@@ -122,63 +131,69 @@
122}131}
123132
124type configInternal struct {133type configInternal struct {
125 dataDir string134 dataDir string
126 tag string135 tag string
127 nonce string136 upgradedToVersion version.Number
128 caCert []byte137 nonce string
129 stateDetails *connectionDetails138 caCert []byte
130 apiDetails *connectionDetails139 stateDetails *connectionDetails
131 oldPassword string140 apiDetails *connectionDetails
132 stateServerCert []byte141 oldPassword string
133 stateServerKey []byte142 stateServerCert []byte
134 apiPort int143 stateServerKey []byte
135 values map[string]string144 apiPort int
145 values map[string]string
136}146}
137147
138type AgentConfigParams struct {148type AgentConfigParams struct {
139 DataDir string149 DataDir string
140 Tag string150 Tag string
141 Password string151 UpgradedToVersion version.Number
142 Nonce string152 Password string
143 StateAddresses []string153 Nonce string
144 APIAddresses []string154 StateAddresses []string
145 CACert []byte155 APIAddresses []string
146 Values map[string]string156 CACert []byte
157 Values map[string]string
147}158}
148159
149// NewAgentConfig returns a new config object suitable for use for a160// NewAgentConfig returns a new config object suitable for use for a
150// machine or unit agent.161// machine or unit agent.
151func NewAgentConfig(params AgentConfigParams) (Config, error) {162func NewAgentConfig(configParams AgentConfigParams) (Config, error) {
152 if params.DataDir == "" {163 if configParams.DataDir == "" {
153 return nil, errgo.Trace(requiredError("data directory"))164 return nil, errgo.Trace(requiredError("data directory"))
154 }165 }
155 if params.Tag == "" {166 if configParams.Tag == "" {
156 return nil, errgo.Trace(requiredError("entity tag"))167 return nil, errgo.Trace(requiredError("entity tag"))
157 }168 }
158 if params.Password == "" {169 if configParams.UpgradedToVersion == version.Zero {
170 return nil, errgo.Trace(requiredError("upgradedToVersion"))
171 }
172 if configParams.Password == "" {
159 return nil, errgo.Trace(requiredError("password"))173 return nil, errgo.Trace(requiredError("password"))
160 }174 }
161 if params.CACert == nil {175 if configParams.CACert == nil {
162 return nil, errgo.Trace(requiredError("CA certificate"))176 return nil, errgo.Trace(requiredError("CA certificate"))
163 }177 }
164 // Note that the password parts of the state and api information are178 // Note that the password parts of the state and api information are
165 // blank. This is by design.179 // blank. This is by design.
166 config := &configInternal{180 config := &configInternal{
167 dataDir: params.DataDir,181 dataDir: configParams.DataDir,
168 tag: params.Tag,182 tag: configParams.Tag,
169 nonce: params.Nonce,183 upgradedToVersion: configParams.UpgradedToVersion,
170 caCert: params.CACert,184 nonce: configParams.Nonce,
171 oldPassword: params.Password,185 caCert: configParams.CACert,
172 values: params.Values,186 oldPassword: configParams.Password,
187 values: configParams.Values,
173 }188 }
174 if len(params.StateAddresses) > 0 {189 if len(configParams.StateAddresses) > 0 {
175 config.stateDetails = &connectionDetails{190 config.stateDetails = &connectionDetails{
176 addresses: params.StateAddresses,191 addresses: configParams.StateAddresses,
177 }192 }
178 }193 }
179 if len(params.APIAddresses) > 0 {194 if len(configParams.APIAddresses) > 0 {
180 config.apiDetails = &connectionDetails{195 config.apiDetails = &connectionDetails{
181 addresses: params.APIAddresses,196 addresses: configParams.APIAddresses,
182 }197 }
183 }198 }
184 if err := config.check(); err != nil {199 if err := config.check(); err != nil {
@@ -200,21 +215,21 @@
200215
201// NewStateMachineConfig returns a configuration suitable for216// NewStateMachineConfig returns a configuration suitable for
202// a machine running the state server.217// a machine running the state server.
203func NewStateMachineConfig(params StateMachineConfigParams) (Config, error) {218func NewStateMachineConfig(configParams StateMachineConfigParams) (Config, error) {
204 if params.StateServerCert == nil {219 if configParams.StateServerCert == nil {
205 return nil, errgo.Trace(requiredError("state server cert"))220 return nil, errgo.Trace(requiredError("state server cert"))
206 }221 }
207 if params.StateServerKey == nil {222 if configParams.StateServerKey == nil {
208 return nil, errgo.Trace(requiredError("state server key"))223 return nil, errgo.Trace(requiredError("state server key"))
209 }224 }
210 config0, err := NewAgentConfig(params.AgentConfigParams)225 config0, err := NewAgentConfig(configParams.AgentConfigParams)
211 if err != nil {226 if err != nil {
212 return nil, err227 return nil, err
213 }228 }
214 config := config0.(*configInternal)229 config := config0.(*configInternal)
215 config.stateServerCert = params.StateServerCert230 config.stateServerCert = configParams.StateServerCert
216 config.stateServerKey = params.StateServerKey231 config.stateServerKey = configParams.StateServerKey
217 config.apiPort = params.APIPort232 config.apiPort = configParams.APIPort
218 return config, nil233 return config, nil
219}234}
220235
@@ -279,6 +294,10 @@
279 return c.nonce294 return c.nonce
280}295}
281296
297func (c *configInternal) UpgradedToVersion() version.Number {
298 return c.upgradedToVersion
299}
300
282func (c *configInternal) CACert() []byte {301func (c *configInternal) CACert() []byte {
283 // Give the caller their own copy of the cert to avoid any possibility of302 // Give the caller their own copy of the cert to avoid any possibility of
284 // modifying the config's copy.303 // modifying the config's copy.
@@ -388,6 +407,17 @@
388 return currentFormatter.write(c)407 return currentFormatter.write(c)
389}408}
390409
410func (c *configInternal) WriteUpgradedToVersion(newVersion version.Number) error {
411 originalVersion := c.upgradedToVersion
412 c.upgradedToVersion = newVersion
413 err := c.Write()
414 if err != nil {
415 // We don't want to retain the new version if there's been an error writing the file.
416 c.upgradedToVersion = originalVersion
417 }
418 return err
419}
420
391func (c *configInternal) WriteCommands() ([]string, error) {421func (c *configInternal) WriteCommands() ([]string, error) {
392 return currentFormatter.writeCommands(c)422 return currentFormatter.writeCommands(c)
393}423}
394424
=== modified file 'agent/agent_test.go'
--- agent/agent_test.go 2013-11-19 13:23:51 +0000
+++ agent/agent_test.go 2014-02-26 03:43:42 +0000
@@ -8,6 +8,7 @@
88
9 "launchpad.net/juju-core/agent"9 "launchpad.net/juju-core/agent"
10 "launchpad.net/juju-core/testing/testbase"10 "launchpad.net/juju-core/testing/testbase"
11 "launchpad.net/juju-core/version"
11)12)
1213
13type suite struct {14type suite struct {
@@ -30,87 +31,103 @@
30 },31 },
31 checkErr: "entity tag not found in configuration",32 checkErr: "entity tag not found in configuration",
32}, {33}, {
34 about: "missing upgraded to version",
35 params: agent.AgentConfigParams{
36 DataDir: "/data/dir",
37 Tag: "omg",
38 },
39 checkErr: "upgradedToVersion not found in configuration",
40}, {
33 about: "missing password",41 about: "missing password",
34 params: agent.AgentConfigParams{42 params: agent.AgentConfigParams{
35 DataDir: "/data/dir",43 DataDir: "/data/dir",
36 Tag: "omg",44 Tag: "omg",
45 UpgradedToVersion: version.Current.Number,
37 },46 },
38 checkErr: "password not found in configuration",47 checkErr: "password not found in configuration",
39}, {48}, {
40 about: "missing CA cert",49 about: "missing CA cert",
41 params: agent.AgentConfigParams{50 params: agent.AgentConfigParams{
42 DataDir: "/data/dir",51 DataDir: "/data/dir",
43 Tag: "omg",52 Tag: "omg",
44 Password: "sekrit",53 UpgradedToVersion: version.Current.Number,
54 Password: "sekrit",
45 },55 },
46 checkErr: "CA certificate not found in configuration",56 checkErr: "CA certificate not found in configuration",
47}, {57}, {
48 about: "need either state or api addresses",58 about: "need either state or api addresses",
49 params: agent.AgentConfigParams{59 params: agent.AgentConfigParams{
50 DataDir: "/data/dir",60 DataDir: "/data/dir",
51 Tag: "omg",61 Tag: "omg",
52 Password: "sekrit",62 UpgradedToVersion: version.Current.Number,
53 CACert: []byte("ca cert"),63 Password: "sekrit",
64 CACert: []byte("ca cert"),
54 },65 },
55 checkErr: "state or API addresses not found in configuration",66 checkErr: "state or API addresses not found in configuration",
56}, {67}, {
57 about: "invalid state address",68 about: "invalid state address",
58 params: agent.AgentConfigParams{69 params: agent.AgentConfigParams{
59 DataDir: "/data/dir",70 DataDir: "/data/dir",
60 Tag: "omg",71 Tag: "omg",
61 Password: "sekrit",72 UpgradedToVersion: version.Current.Number,
62 CACert: []byte("ca cert"),73 Password: "sekrit",
63 StateAddresses: []string{"localhost:8080", "bad-address"},74 CACert: []byte("ca cert"),
75 StateAddresses: []string{"localhost:8080", "bad-address"},
64 },76 },
65 checkErr: `invalid state server address "bad-address"`,77 checkErr: `invalid state server address "bad-address"`,
66}, {78}, {
67 about: "invalid api address",79 about: "invalid api address",
68 params: agent.AgentConfigParams{80 params: agent.AgentConfigParams{
69 DataDir: "/data/dir",81 DataDir: "/data/dir",
70 Tag: "omg",82 Tag: "omg",
71 Password: "sekrit",83 UpgradedToVersion: version.Current.Number,
72 CACert: []byte("ca cert"),84 Password: "sekrit",
73 APIAddresses: []string{"localhost:8080", "bad-address"},85 CACert: []byte("ca cert"),
86 APIAddresses: []string{"localhost:8080", "bad-address"},
74 },87 },
75 checkErr: `invalid API server address "bad-address"`,88 checkErr: `invalid API server address "bad-address"`,
76}, {89}, {
77 about: "good state addresses",90 about: "good state addresses",
78 params: agent.AgentConfigParams{91 params: agent.AgentConfigParams{
79 DataDir: "/data/dir",92 DataDir: "/data/dir",
80 Tag: "omg",93 Tag: "omg",
81 Password: "sekrit",94 UpgradedToVersion: version.Current.Number,
82 CACert: []byte("ca cert"),95 Password: "sekrit",
83 StateAddresses: []string{"localhost:1234"},96 CACert: []byte("ca cert"),
97 StateAddresses: []string{"localhost:1234"},
84 },98 },
85}, {99}, {
86 about: "good api addresses",100 about: "good api addresses",
87 params: agent.AgentConfigParams{101 params: agent.AgentConfigParams{
88 DataDir: "/data/dir",102 DataDir: "/data/dir",
89 Tag: "omg",103 Tag: "omg",
90 Password: "sekrit",104 UpgradedToVersion: version.Current.Number,
91 CACert: []byte("ca cert"),105 Password: "sekrit",
92 APIAddresses: []string{"localhost:1234"},106 CACert: []byte("ca cert"),
107 APIAddresses: []string{"localhost:1234"},
93 },108 },
94}, {109}, {
95 about: "both state and api addresses",110 about: "both state and api addresses",
96 params: agent.AgentConfigParams{111 params: agent.AgentConfigParams{
97 DataDir: "/data/dir",112 DataDir: "/data/dir",
98 Tag: "omg",113 Tag: "omg",
99 Password: "sekrit",114 UpgradedToVersion: version.Current.Number,
100 CACert: []byte("ca cert"),115 Password: "sekrit",
101 StateAddresses: []string{"localhost:1234"},116 CACert: []byte("ca cert"),
102 APIAddresses: []string{"localhost:1235"},117 StateAddresses: []string{"localhost:1234"},
118 APIAddresses: []string{"localhost:1235"},
103 },119 },
104}, {120}, {
105 about: "everything...",121 about: "everything...",
106 params: agent.AgentConfigParams{122 params: agent.AgentConfigParams{
107 DataDir: "/data/dir",123 DataDir: "/data/dir",
108 Tag: "omg",124 Tag: "omg",
109 Password: "sekrit",125 Password: "sekrit",
110 CACert: []byte("ca cert"),126 UpgradedToVersion: version.Current.Number,
111 StateAddresses: []string{"localhost:1234"},127 CACert: []byte("ca cert"),
112 APIAddresses: []string{"localhost:1235"},128 StateAddresses: []string{"localhost:1234"},
113 Nonce: "a nonce",129 APIAddresses: []string{"localhost:1235"},
130 Nonce: "a nonce",
114 },131 },
115}}132}}
116133
@@ -168,13 +185,14 @@
168}185}
169186
170var attributeParams = agent.AgentConfigParams{187var attributeParams = agent.AgentConfigParams{
171 DataDir: "/data/dir",188 DataDir: "/data/dir",
172 Tag: "omg",189 Tag: "omg",
173 Password: "sekrit",190 UpgradedToVersion: version.Current.Number,
174 CACert: []byte("ca cert"),191 Password: "sekrit",
175 StateAddresses: []string{"localhost:1234"},192 CACert: []byte("ca cert"),
176 APIAddresses: []string{"localhost:1235"},193 StateAddresses: []string{"localhost:1234"},
177 Nonce: "a nonce",194 APIAddresses: []string{"localhost:1235"},
195 Nonce: "a nonce",
178}196}
179197
180func (*suite) TestAttributes(c *gc.C) {198func (*suite) TestAttributes(c *gc.C) {
@@ -184,6 +202,7 @@
184 c.Assert(conf.Tag(), gc.Equals, "omg")202 c.Assert(conf.Tag(), gc.Equals, "omg")
185 c.Assert(conf.Dir(), gc.Equals, "/data/dir/agents/omg")203 c.Assert(conf.Dir(), gc.Equals, "/data/dir/agents/omg")
186 c.Assert(conf.Nonce(), gc.Equals, "a nonce")204 c.Assert(conf.Nonce(), gc.Equals, "a nonce")
205 c.Assert(conf.UpgradedToVersion(), gc.DeepEquals, version.Current.Number)
187}206}
188207
189func (s *suite) TestApiAddressesCantWriteBack(c *gc.C) {208func (s *suite) TestApiAddressesCantWriteBack(c *gc.C) {
@@ -198,22 +217,27 @@
198 c.Assert(err, gc.IsNil)217 c.Assert(err, gc.IsNil)
199 c.Assert(newValue, gc.DeepEquals, []string{"localhost:1235"})218 c.Assert(newValue, gc.DeepEquals, []string{"localhost:1235"})
200}219}
201func (*suite) TestWriteAndRead(c *gc.C) {
202 testParams := attributeParams
203 testParams.DataDir = c.MkDir()
204 conf, err := agent.NewAgentConfig(testParams)
205 c.Assert(err, gc.IsNil)
206220
207 c.Assert(conf.Write(), gc.IsNil)221func assertConfigEqual(c *gc.C, c1, c2 agent.Config) {
208 reread, err := agent.ReadConf(conf.DataDir(), conf.Tag())
209 c.Assert(err, gc.IsNil)
210 // Since we can't directly poke the internals, we'll use the WriteCommands222 // Since we can't directly poke the internals, we'll use the WriteCommands
211 // method.223 // method.
212 confCommands, err := conf.WriteCommands()224 conf1Commands, err := c1.WriteCommands()
213 c.Assert(err, gc.IsNil)225 c.Assert(err, gc.IsNil)
214 rereadCommands, err := reread.WriteCommands()226 conf2Commands, err := c2.WriteCommands()
215 c.Assert(err, gc.IsNil)227 c.Assert(err, gc.IsNil)
216 c.Assert(confCommands, gc.DeepEquals, rereadCommands)228 c.Assert(conf1Commands, gc.DeepEquals, conf2Commands)
229}
230
231func (*suite) TestWriteAndRead(c *gc.C) {
232 testParams := attributeParams
233 testParams.DataDir = c.MkDir()
234 conf, err := agent.NewAgentConfig(testParams)
235 c.Assert(err, gc.IsNil)
236
237 c.Assert(conf.Write(), gc.IsNil)
238 reread, err := agent.ReadConf(conf.DataDir(), conf.Tag())
239 c.Assert(err, gc.IsNil)
240 assertConfigEqual(c, conf, reread)
217}241}
218242
219func (*suite) TestWriteNewPassword(c *gc.C) {243func (*suite) TestWriteNewPassword(c *gc.C) {
@@ -224,30 +248,33 @@
224 }{{248 }{{
225 about: "good state addresses",249 about: "good state addresses",
226 params: agent.AgentConfigParams{250 params: agent.AgentConfigParams{
227 DataDir: c.MkDir(),251 DataDir: c.MkDir(),
228 Tag: "omg",252 Tag: "omg",
229 Password: "sekrit",253 UpgradedToVersion: version.Current.Number,
230 CACert: []byte("ca cert"),254 Password: "sekrit",
231 StateAddresses: []string{"localhost:1234"},255 CACert: []byte("ca cert"),
256 StateAddresses: []string{"localhost:1234"},
232 },257 },
233 }, {258 }, {
234 about: "good api addresses",259 about: "good api addresses",
235 params: agent.AgentConfigParams{260 params: agent.AgentConfigParams{
236 DataDir: c.MkDir(),261 DataDir: c.MkDir(),
237 Tag: "omg",262 Tag: "omg",
238 Password: "sekrit",263 UpgradedToVersion: version.Current.Number,
239 CACert: []byte("ca cert"),264 Password: "sekrit",
240 APIAddresses: []string{"localhost:1234"},265 CACert: []byte("ca cert"),
266 APIAddresses: []string{"localhost:1234"},
241 },267 },
242 }, {268 }, {
243 about: "both state and api addresses",269 about: "both state and api addresses",
244 params: agent.AgentConfigParams{270 params: agent.AgentConfigParams{
245 DataDir: c.MkDir(),271 DataDir: c.MkDir(),
246 Tag: "omg",272 Tag: "omg",
247 Password: "sekrit",273 UpgradedToVersion: version.Current.Number,
248 CACert: []byte("ca cert"),274 Password: "sekrit",
249 StateAddresses: []string{"localhost:1234"},275 CACert: []byte("ca cert"),
250 APIAddresses: []string{"localhost:1235"},276 StateAddresses: []string{"localhost:1234"},
277 APIAddresses: []string{"localhost:1235"},
251 },278 },
252 }} {279 }} {
253 c.Logf("%v: %s", i, test.about)280 c.Logf("%v: %s", i, test.about)
@@ -263,6 +290,23 @@
263 }290 }
264}291}
265292
293func (*suite) TestWriteUpgradedToVersion(c *gc.C) {
294 testParams := attributeParams
295 testParams.DataDir = c.MkDir()
296 conf, err := agent.NewAgentConfig(testParams)
297 c.Assert(err, gc.IsNil)
298 c.Assert(conf.Write(), gc.IsNil)
299
300 newVersion := version.Current.Number
301 newVersion.Major++
302 c.Assert(conf.WriteUpgradedToVersion(newVersion), gc.IsNil)
303 c.Assert(conf.UpgradedToVersion(), gc.DeepEquals, newVersion)
304
305 // Show that the upgradedToVersion is saved.
306 reread, err := agent.ReadConf(conf.DataDir(), conf.Tag())
307 assertConfigEqual(c, conf, reread)
308}
309
266// Actual opening of state and api requires a lot more boiler plate to make310// Actual opening of state and api requires a lot more boiler plate to make
267// sure they are valid connections. This is done in the cmd/jujud tests for311// sure they are valid connections. This is done in the cmd/jujud tests for
268// bootstrap, machine and unit tests.312// bootstrap, machine and unit tests.
269313
=== modified file 'agent/bootstrap_test.go'
--- agent/bootstrap_test.go 2014-02-19 06:50:24 +0000
+++ agent/bootstrap_test.go 2014-02-26 03:43:42 +0000
@@ -51,11 +51,12 @@
5151
52 pwHash := utils.UserPasswordHash(testing.DefaultMongoPassword, utils.CompatSalt)52 pwHash := utils.UserPasswordHash(testing.DefaultMongoPassword, utils.CompatSalt)
53 cfg, err := agent.NewAgentConfig(agent.AgentConfigParams{53 cfg, err := agent.NewAgentConfig(agent.AgentConfigParams{
54 DataDir: dataDir,54 DataDir: dataDir,
55 Tag: "machine-0",55 Tag: "machine-0",
56 StateAddresses: []string{testing.MgoServer.Addr()},56 UpgradedToVersion: version.Current.Number,
57 CACert: []byte(testing.CACert),57 StateAddresses: []string{testing.MgoServer.Addr()},
58 Password: pwHash,58 CACert: []byte(testing.CACert),
59 Password: pwHash,
59 })60 })
60 c.Assert(err, gc.IsNil)61 c.Assert(err, gc.IsNil)
61 expectConstraints := constraints.MustParse("mem=1024M")62 expectConstraints := constraints.MustParse("mem=1024M")
@@ -116,11 +117,12 @@
116 dataDir := c.MkDir()117 dataDir := c.MkDir()
117 pwHash := utils.UserPasswordHash(testing.DefaultMongoPassword, utils.CompatSalt)118 pwHash := utils.UserPasswordHash(testing.DefaultMongoPassword, utils.CompatSalt)
118 cfg, err := agent.NewAgentConfig(agent.AgentConfigParams{119 cfg, err := agent.NewAgentConfig(agent.AgentConfigParams{
119 DataDir: dataDir,120 DataDir: dataDir,
120 Tag: "machine-0",121 Tag: "machine-0",
121 StateAddresses: []string{testing.MgoServer.Addr()},122 UpgradedToVersion: version.Current.Number,
122 CACert: []byte(testing.CACert),123 StateAddresses: []string{testing.MgoServer.Addr()},
123 Password: pwHash,124 CACert: []byte(testing.CACert),
125 Password: pwHash,
124 })126 })
125 c.Assert(err, gc.IsNil)127 c.Assert(err, gc.IsNil)
126 expectConstraints := constraints.MustParse("mem=1024M")128 expectConstraints := constraints.MustParse("mem=1024M")
127129
=== modified file 'agent/format-1.12_whitebox_test.go'
--- agent/format-1.12_whitebox_test.go 2013-10-04 16:16:10 +0000
+++ agent/format-1.12_whitebox_test.go 2014-02-26 03:43:42 +0000
@@ -11,6 +11,7 @@
1111
12 jc "launchpad.net/juju-core/testing/checkers"12 jc "launchpad.net/juju-core/testing/checkers"
13 "launchpad.net/juju-core/testing/testbase"13 "launchpad.net/juju-core/testing/testbase"
14 "launchpad.net/juju-core/version"
14)15)
1516
16type format_1_12Suite struct {17type format_1_12Suite struct {
@@ -42,6 +43,8 @@
42}43}
4344
44func (s *format_1_12Suite) assertWriteAndRead(c *gc.C, config *configInternal) {45func (s *format_1_12Suite) assertWriteAndRead(c *gc.C, config *configInternal) {
46 // Format 1.12 doesn't know about upgradedToVersion so zero it out.
47 config.upgradedToVersion = version.Zero
45 err := s.formatter.write(config)48 err := s.formatter.write(config)
46 c.Assert(err, gc.IsNil)49 c.Assert(err, gc.IsNil)
47 // The readConfig is missing the dataDir initially.50 // The readConfig is missing the dataDir initially.
4851
=== modified file 'agent/format-1.16.go'
--- agent/format-1.16.go 2014-02-12 21:14:17 +0000
+++ agent/format-1.16.go 2014-02-26 03:43:42 +0000
@@ -12,6 +12,7 @@
12 "launchpad.net/goyaml"12 "launchpad.net/goyaml"
1313
14 "launchpad.net/juju-core/juju/osenv"14 "launchpad.net/juju-core/juju/osenv"
15 "launchpad.net/juju-core/version"
15)16)
1617
17const (18const (
@@ -29,8 +30,9 @@
2930
30// format_1_16Serialization holds information for a given agent.31// format_1_16Serialization holds information for a given agent.
31type format_1_16Serialization struct {32type format_1_16Serialization struct {
32 Tag string33 Tag string
33 Nonce string34 Nonce string
35 UpgradedToVersion string `yaml:"upgradedToVersion"`
34 // CACert is base64 encoded36 // CACert is base64 encoded
35 CACert string37 CACert string
36 StateAddresses []string `yaml:",omitempty"`38 StateAddresses []string `yaml:",omitempty"`
@@ -64,6 +66,15 @@
64 return66 return
65}67}
6668
69// upgradedToVersion parses the upgradedToVersion string value into a version.Number.
70// An empty value is returned as 1.16.0.
71func (*formatter_1_16) upgradedToVersion(value string) (version.Number, error) {
72 if value != "" {
73 return version.Parse(value)
74 }
75 return version.MustParse("1.16.0"), nil
76}
77
67func (formatter *formatter_1_16) read(dirName string) (*configInternal, error) {78func (formatter *formatter_1_16) read(dirName string) (*configInternal, error) {
68 data, err := ioutil.ReadFile(formatter.configFile(dirName))79 data, err := ioutil.ReadFile(formatter.configFile(dirName))
69 if err != nil {80 if err != nil {
@@ -85,15 +96,20 @@
85 if err != nil {96 if err != nil {
86 return nil, err97 return nil, err
87 }98 }
99 upgradedToVersion, err := formatter.upgradedToVersion(format.UpgradedToVersion)
100 if err != nil {
101 return nil, err
102 }
88 config := &configInternal{103 config := &configInternal{
89 tag: format.Tag,104 tag: format.Tag,
90 nonce: format.Nonce,105 nonce: format.Nonce,
91 caCert: caCert,106 upgradedToVersion: upgradedToVersion,
92 oldPassword: format.OldPassword,107 caCert: caCert,
93 stateServerCert: stateServerCert,108 oldPassword: format.OldPassword,
94 stateServerKey: stateServerKey,109 stateServerCert: stateServerCert,
95 apiPort: format.APIPort,110 stateServerKey: stateServerKey,
96 values: format.Values,111 apiPort: format.APIPort,
112 values: format.Values,
97 }113 }
98 if len(format.StateAddresses) > 0 {114 if len(format.StateAddresses) > 0 {
99 config.stateDetails = &connectionDetails{115 config.stateDetails = &connectionDetails{
@@ -112,14 +128,15 @@
112128
113func (formatter *formatter_1_16) makeFormat(config *configInternal) *format_1_16Serialization {129func (formatter *formatter_1_16) makeFormat(config *configInternal) *format_1_16Serialization {
114 format := &format_1_16Serialization{130 format := &format_1_16Serialization{
115 Tag: config.tag,131 Tag: config.tag,
116 Nonce: config.nonce,132 Nonce: config.nonce,
117 CACert: base64.StdEncoding.EncodeToString(config.caCert),133 UpgradedToVersion: config.upgradedToVersion.String(),
118 OldPassword: config.oldPassword,134 CACert: base64.StdEncoding.EncodeToString(config.caCert),
119 StateServerCert: base64.StdEncoding.EncodeToString(config.stateServerCert),135 OldPassword: config.oldPassword,
120 StateServerKey: base64.StdEncoding.EncodeToString(config.stateServerKey),136 StateServerCert: base64.StdEncoding.EncodeToString(config.stateServerCert),
121 APIPort: config.apiPort,137 StateServerKey: base64.StdEncoding.EncodeToString(config.stateServerKey),
122 Values: config.values,138 APIPort: config.apiPort,
139 Values: config.values,
123 }140 }
124 if config.stateDetails != nil {141 if config.stateDetails != nil {
125 format.StateAddresses = config.stateDetails.addresses142 format.StateAddresses = config.stateDetails.addresses
126143
=== modified file 'agent/format-1.16_whitebox_test.go'
--- agent/format-1.16_whitebox_test.go 2014-02-12 21:14:17 +0000
+++ agent/format-1.16_whitebox_test.go 2014-02-26 03:43:42 +0000
@@ -8,14 +8,17 @@
8package agent8package agent
99
10import (10import (
11 "io/ioutil"
11 "os"12 "os"
12 "path"13 "path"
14 "path/filepath"
1315
14 gc "launchpad.net/gocheck"16 gc "launchpad.net/gocheck"
1517
16 "launchpad.net/juju-core/juju/osenv"18 "launchpad.net/juju-core/juju/osenv"
17 jc "launchpad.net/juju-core/testing/checkers"19 jc "launchpad.net/juju-core/testing/checkers"
18 "launchpad.net/juju-core/testing/testbase"20 "launchpad.net/juju-core/testing/testbase"
21 "launchpad.net/juju-core/version"
19)22)
2023
21type format_1_16Suite struct {24type format_1_16Suite struct {
@@ -48,6 +51,27 @@
48 c.Assert(formatContent, gc.Equals, format_1_16)51 c.Assert(formatContent, gc.Equals, format_1_16)
49}52}
5053
54var configDataWithoutUpgradedToVersion = `
55tag: omg
56nonce: a nonce
57cacert: Y2EgY2VydA==
58stateaddresses:
59- localhost:1234
60apiaddresses:
61- localhost:1235
62oldpassword: sekrit
63values: {}
64`
65
66func (s *format_1_16Suite) TestMissingUpgradedToVersion(c *gc.C) {
67 dataDir := c.MkDir()
68 err := ioutil.WriteFile(filepath.Join(dataDir, "agent.conf"), []byte(configDataWithoutUpgradedToVersion), 0600)
69 c.Assert(err, gc.IsNil)
70 readConfig, err := s.formatter.read(dataDir)
71 c.Assert(err, gc.IsNil)
72 c.Assert(readConfig.UpgradedToVersion(), gc.Equals, version.MustParse("1.16.0"))
73}
74
51func (s *format_1_16Suite) assertWriteAndRead(c *gc.C, config *configInternal) {75func (s *format_1_16Suite) assertWriteAndRead(c *gc.C, config *configInternal) {
52 err := s.formatter.write(config)76 err := s.formatter.write(config)
53 c.Assert(err, gc.IsNil)77 c.Assert(err, gc.IsNil)
@@ -56,7 +80,7 @@
56 c.Assert(err, gc.IsNil)80 c.Assert(err, gc.IsNil)
57 c.Assert(readConfig.dataDir, gc.Equals, "")81 c.Assert(readConfig.dataDir, gc.Equals, "")
58 // This is put in by the ReadConf method that we are avoiding using82 // This is put in by the ReadConf method that we are avoiding using
59 // becuase it will have side-effects soon around migrating configs.83 // because it will have side-effects soon around migrating configs.
60 readConfig.dataDir = config.dataDir84 readConfig.dataDir = config.dataDir
61 c.Assert(readConfig, gc.DeepEquals, config)85 c.Assert(readConfig, gc.DeepEquals, config)
62}86}
6387
=== modified file 'agent/format_whitebox_test.go'
--- agent/format_whitebox_test.go 2013-10-04 16:16:10 +0000
+++ agent/format_whitebox_test.go 2014-02-26 03:43:42 +0000
@@ -10,6 +10,7 @@
10 gc "launchpad.net/gocheck"10 gc "launchpad.net/gocheck"
1111
12 "launchpad.net/juju-core/testing/testbase"12 "launchpad.net/juju-core/testing/testbase"
13 "launchpad.net/juju-core/version"
13)14)
1415
15type formatSuite struct {16type formatSuite struct {
@@ -21,12 +22,13 @@
21// The agentParams are used by the specific formatter whitebox tests, and is22// The agentParams are used by the specific formatter whitebox tests, and is
22// located here for easy reuse.23// located here for easy reuse.
23var agentParams = AgentConfigParams{24var agentParams = AgentConfigParams{
24 Tag: "omg",25 Tag: "omg",
25 Password: "sekrit",26 UpgradedToVersion: version.Current.Number,
26 CACert: []byte("ca cert"),27 Password: "sekrit",
27 StateAddresses: []string{"localhost:1234"},28 CACert: []byte("ca cert"),
28 APIAddresses: []string{"localhost:1235"},29 StateAddresses: []string{"localhost:1234"},
29 Nonce: "a nonce",30 APIAddresses: []string{"localhost:1235"},
31 Nonce: "a nonce",
30}32}
3133
32func (*formatSuite) TestReadFormatEmptyDir(c *gc.C) {34func (*formatSuite) TestReadFormatEmptyDir(c *gc.C) {
3335
=== modified file 'cmd/jujud/agent_test.go'
--- cmd/jujud/agent_test.go 2014-02-20 08:23:40 +0000
+++ cmd/jujud/agent_test.go 2014-02-26 03:43:42 +0000
@@ -207,13 +207,14 @@
207 apiInfo := s.APIInfo(c)207 apiInfo := s.APIInfo(c)
208 conf, err := agent.NewAgentConfig(208 conf, err := agent.NewAgentConfig(
209 agent.AgentConfigParams{209 agent.AgentConfigParams{
210 DataDir: s.DataDir(),210 DataDir: s.DataDir(),
211 Tag: tag,211 Tag: tag,
212 Password: password,212 UpgradedToVersion: version.Current.Number,
213 Nonce: state.BootstrapNonce,213 Password: password,
214 StateAddresses: stateInfo.Addrs,214 Nonce: state.BootstrapNonce,
215 APIAddresses: apiInfo.Addrs,215 StateAddresses: stateInfo.Addrs,
216 CACert: stateInfo.CACert,216 APIAddresses: apiInfo.Addrs,
217 CACert: stateInfo.CACert,
217 })218 })
218 c.Assert(conf.Write(), gc.IsNil)219 c.Assert(conf.Write(), gc.IsNil)
219 return conf, agentTools220 return conf, agentTools
@@ -226,13 +227,14 @@
226 conf, err := agent.NewStateMachineConfig(227 conf, err := agent.NewStateMachineConfig(
227 agent.StateMachineConfigParams{228 agent.StateMachineConfigParams{
228 AgentConfigParams: agent.AgentConfigParams{229 AgentConfigParams: agent.AgentConfigParams{
229 DataDir: dataDir,230 DataDir: dataDir,
230 Tag: tag,231 Tag: tag,
231 Password: password,232 UpgradedToVersion: version.Current.Number,
232 Nonce: state.BootstrapNonce,233 Password: password,
233 StateAddresses: stateInfo.Addrs,234 Nonce: state.BootstrapNonce,
234 APIAddresses: apiAddr,235 StateAddresses: stateInfo.Addrs,
235 CACert: stateInfo.CACert,236 APIAddresses: apiAddr,
237 CACert: stateInfo.CACert,
236 },238 },
237 StateServerCert: []byte(coretesting.ServerCert),239 StateServerCert: []byte(coretesting.ServerCert),
238 StateServerKey: []byte(coretesting.ServerKey),240 StateServerKey: []byte(coretesting.ServerKey),
239241
=== modified file 'cmd/jujud/bootstrap_test.go'
--- cmd/jujud/bootstrap_test.go 2014-02-19 06:31:52 +0000
+++ cmd/jujud/bootstrap_test.go 2014-02-26 03:43:42 +0000
@@ -24,6 +24,7 @@
24 jc "launchpad.net/juju-core/testing/checkers"24 jc "launchpad.net/juju-core/testing/checkers"
25 "launchpad.net/juju-core/testing/testbase"25 "launchpad.net/juju-core/testing/testbase"
26 "launchpad.net/juju-core/utils"26 "launchpad.net/juju-core/utils"
27 "launchpad.net/juju-core/version"
27)28)
2829
29// We don't want to use JujuConnSuite because it gives us30// We don't want to use JujuConnSuite because it gives us
@@ -85,13 +86,14 @@
85 // NOTE: the old test used an equivalent of the NewAgentConfig, but it86 // NOTE: the old test used an equivalent of the NewAgentConfig, but it
86 // really should be using NewStateMachineConfig.87 // really should be using NewStateMachineConfig.
87 params := agent.AgentConfigParams{88 params := agent.AgentConfigParams{
88 DataDir: s.dataDir,89 DataDir: s.dataDir,
89 Tag: "bootstrap",90 Tag: "bootstrap",
90 Password: testPasswordHash(),91 UpgradedToVersion: version.Current.Number,
91 Nonce: state.BootstrapNonce,92 Password: testPasswordHash(),
92 StateAddresses: []string{testing.MgoServer.Addr()},93 Nonce: state.BootstrapNonce,
93 APIAddresses: []string{"0.1.2.3:1234"},94 StateAddresses: []string{testing.MgoServer.Addr()},
94 CACert: []byte(testing.CACert),95 APIAddresses: []string{"0.1.2.3:1234"},
96 CACert: []byte(testing.CACert),
95 }97 }
96 bootConf, err := agent.NewAgentConfig(params)98 bootConf, err := agent.NewAgentConfig(params)
97 c.Assert(err, gc.IsNil)99 c.Assert(err, gc.IsNil)
98100
=== modified file 'environs/cloudinit/cloudinit.go'
--- environs/cloudinit/cloudinit.go 2014-02-20 15:03:08 +0000
+++ environs/cloudinit/cloudinit.go 2014-02-26 03:43:42 +0000
@@ -27,6 +27,7 @@
27 coretools "launchpad.net/juju-core/tools"27 coretools "launchpad.net/juju-core/tools"
28 "launchpad.net/juju-core/upstart"28 "launchpad.net/juju-core/upstart"
29 "launchpad.net/juju-core/utils"29 "launchpad.net/juju-core/utils"
30 "launchpad.net/juju-core/version"
30)31)
3132
32// BootstrapStateURLFile is used to communicate to the first bootstrap node33// BootstrapStateURLFile is used to communicate to the first bootstrap node
@@ -436,14 +437,15 @@
436 password = cfg.StateInfo.Password437 password = cfg.StateInfo.Password
437 }438 }
438 configParams := agent.AgentConfigParams{439 configParams := agent.AgentConfigParams{
439 DataDir: cfg.DataDir,440 DataDir: cfg.DataDir,
440 Tag: tag,441 Tag: tag,
441 Password: password,442 UpgradedToVersion: version.Current.Number,
442 Nonce: cfg.MachineNonce,443 Password: password,
443 StateAddresses: cfg.stateHostAddrs(),444 Nonce: cfg.MachineNonce,
444 APIAddresses: cfg.apiHostAddrs(),445 StateAddresses: cfg.stateHostAddrs(),
445 CACert: cfg.StateInfo.CACert,446 APIAddresses: cfg.apiHostAddrs(),
446 Values: cfg.AgentEnvironment,447 CACert: cfg.StateInfo.CACert,
448 Values: cfg.AgentEnvironment,
447 }449 }
448 if !cfg.StateServer {450 if !cfg.StateServer {
449 return agent.NewAgentConfig(configParams)451 return agent.NewAgentConfig(configParams)
450452
=== modified file 'juju/testing/conn.go'
--- juju/testing/conn.go 2014-02-20 04:59:31 +0000
+++ juju/testing/conn.go 2014-02-26 03:43:42 +0000
@@ -300,13 +300,14 @@
300 c.Assert(err, gc.IsNil)300 c.Assert(err, gc.IsNil)
301 config, err := agent.NewAgentConfig(301 config, err := agent.NewAgentConfig(
302 agent.AgentConfigParams{302 agent.AgentConfigParams{
303 DataDir: s.DataDir(),303 DataDir: s.DataDir(),
304 Tag: tag,304 Tag: tag,
305 Password: password,305 UpgradedToVersion: version.Current.Number,
306 Nonce: "nonce",306 Password: password,
307 StateAddresses: s.StateInfo(c).Addrs,307 Nonce: "nonce",
308 APIAddresses: s.APIInfo(c).Addrs,308 StateAddresses: s.StateInfo(c).Addrs,
309 CACert: []byte(testing.CACert),309 APIAddresses: s.APIInfo(c).Addrs,
310 CACert: []byte(testing.CACert),
310 })311 })
311 c.Assert(err, gc.IsNil)312 c.Assert(err, gc.IsNil)
312 return config313 return config
313314
=== modified file 'worker/deployer/simple.go'
--- worker/deployer/simple.go 2014-02-12 07:24:47 +0000
+++ worker/deployer/simple.go 2014-02-26 03:43:42 +0000
@@ -102,10 +102,11 @@
102 namespace := ctx.agentConfig.Value(agent.Namespace)102 namespace := ctx.agentConfig.Value(agent.Namespace)
103 conf, err := agent.NewAgentConfig(103 conf, err := agent.NewAgentConfig(
104 agent.AgentConfigParams{104 agent.AgentConfigParams{
105 DataDir: dataDir,105 DataDir: dataDir,
106 Tag: tag,106 Tag: tag,
107 Password: initialPassword,107 UpgradedToVersion: version.Current.Number,
108 Nonce: "unused",108 Password: initialPassword,
109 Nonce: "unused",
109 // TODO: remove the state addresses here and test when api only.110 // TODO: remove the state addresses here and test when api only.
110 StateAddresses: result.StateAddresses,111 StateAddresses: result.StateAddresses,
111 APIAddresses: result.APIAddresses,112 APIAddresses: result.APIAddresses,
112113
=== modified file 'worker/provisioner/kvm-broker_test.go'
--- worker/provisioner/kvm-broker_test.go 2014-01-22 19:28:08 +0000
+++ worker/provisioner/kvm-broker_test.go 2014-02-26 03:43:42 +0000
@@ -66,12 +66,13 @@
66 var err error66 var err error
67 s.agentConfig, err = agent.NewAgentConfig(67 s.agentConfig, err = agent.NewAgentConfig(
68 agent.AgentConfigParams{68 agent.AgentConfigParams{
69 DataDir: "/not/used/here",69 DataDir: "/not/used/here",
70 Tag: "tag",70 Tag: "tag",
71 Password: "dummy-secret",71 UpgradedToVersion: version.Current.Number,
72 Nonce: "nonce",72 Password: "dummy-secret",
73 APIAddresses: []string{"10.0.0.1:1234"},73 Nonce: "nonce",
74 CACert: []byte(coretesting.CACert),74 APIAddresses: []string{"10.0.0.1:1234"},
75 CACert: []byte(coretesting.CACert),
75 })76 })
76 c.Assert(err, gc.IsNil)77 c.Assert(err, gc.IsNil)
77 s.broker, err = provisioner.NewKvmBroker(&fakeAPI{}, tools, s.agentConfig)78 s.broker, err = provisioner.NewKvmBroker(&fakeAPI{}, tools, s.agentConfig)
7879
=== modified file 'worker/provisioner/lxc-broker_test.go'
--- worker/provisioner/lxc-broker_test.go 2014-02-14 11:33:57 +0000
+++ worker/provisioner/lxc-broker_test.go 2014-02-26 03:43:42 +0000
@@ -68,12 +68,13 @@
68 var err error68 var err error
69 s.agentConfig, err = agent.NewAgentConfig(69 s.agentConfig, err = agent.NewAgentConfig(
70 agent.AgentConfigParams{70 agent.AgentConfigParams{
71 DataDir: "/not/used/here",71 DataDir: "/not/used/here",
72 Tag: "tag",72 Tag: "tag",
73 Password: "dummy-secret",73 UpgradedToVersion: version.Current.Number,
74 Nonce: "nonce",74 Password: "dummy-secret",
75 APIAddresses: []string{"10.0.0.1:1234"},75 Nonce: "nonce",
76 CACert: []byte(coretesting.CACert),76 APIAddresses: []string{"10.0.0.1:1234"},
77 CACert: []byte(coretesting.CACert),
77 })78 })
78 c.Assert(err, gc.IsNil)79 c.Assert(err, gc.IsNil)
79 s.broker = provisioner.NewLxcBroker(&fakeAPI{}, tools, s.agentConfig)80 s.broker = provisioner.NewLxcBroker(&fakeAPI{}, tools, s.agentConfig)

Subscribers

People subscribed via source and target branches

to status/vote changes: