Description:
state: write agent tools version into initial EnvironConfig
We will use this mechanism to trigger upgrades.
Note that because we use the EnvironConfig to hold
the version, environment providers can no longer be
strict about the fields they accept.
Reviewers: mp+122019_ code.launchpad. net,
Message:
Please take a look.
Description:
state: write agent tools version into initial EnvironConfig
We will use this mechanism to trigger upgrades.
Note that because we use the EnvironConfig to hold
the version, environment providers can no longer be
strict about the fields they accept.
https:/ /code.launchpad .net/~rogpeppe/ juju-core/ 039-init- agent-version/ +merge/ 122019
Requires: /code.launchpad .net/~rogpeppe/ juju-core/ 041-config- agent-version/ +merge/ 122016
https:/
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6494057/
Affected files: provisioning_ test.go
A [revision details]
M cmd/jujud/
M state/open.go
M state/state_test.go
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: state/open.go net/goyaml" net/gozk/ zookeeper" net/juju- core/log" net/juju- core/version" "/relations" , "", 0, zkPermAll); err != nil { Marshal( config) zkEnvironmentPa th, string(yaml), 0, zkPermAll); zkEnvironmentPa th, "", 0, zkPermAll); err != nil { e(s.zk, zkEnvironmentPath, config) agent-version" , version. Current. Number. String( ))
=== modified file 'state/open.go'
--- state/open.go 2012-08-20 01:19:38 +0000
+++ state/open.go 2012-08-29 17:42:03 +0000
@@ -3,9 +3,9 @@
import (
"errors"
"fmt"
- "launchpad.
"launchpad.
"launchpad.
+ "launchpad.
"strings"
"time"
)
@@ -110,16 +110,16 @@
if _, err := s.zk.Create(
return err
}
- // TODO Create node for bootstrap machine.
-
- if config != nil {
- yaml, err := goyaml.
- if err != nil {
- return err
- }
- if _, err := s.zk.Create(
err != nil {
- return err
- }
+ if _, err = s.zk.Create(
+ return err
+ }
+ n, err := createConfigNod
+ if err != nil {
+ return err
+ }
+ n.Set("
+ if _, err = n.Write(); err != nil {
+ return err
}
// Finally creation of /initialized as marker.
Index: state/state_test.go state_test. go' net/juju- core/juju/ testing" net/juju- core/state" net/juju- core/testing" net/juju- core/version" "state. Open blocked forever") interface{ }{ Current. Number. String( ),
=== modified file 'state/
--- state/state_test.go 2012-08-24 01:45:40 +0000
+++ state/state_test.go 2012-08-29 17:44:53 +0000
@@ -8,6 +8,7 @@
"launchpad.
"launchpad.
coretesting "launchpad.
+ "launchpad.
"net/url"
"sort"
stdtesting "testing"
@@ -79,6 +80,12 @@
case <-time.After(1e9):
c.Fatalf(
}
+
+ cfg, err := st.EnvironConfig()
+ c.Assert(err, IsNil)
+ c.Assert(cfg.Map(), DeepEquals, map[string]
+ "agent-version": version.
+ })
}
func (s *StateSuite) TestInitalizeWi thConfig( c *C) { -keys": "i-am-a-key", Current. Number. String( ), e(s.StateInfo( c), m)
@@ -90,6 +97,7 @@
"type": "dummy",
"zookeeper": true,
"authorized
+ "agent-version": version.
}
st, err := state.Initializ
c.Assert(err, IsNil)
Index: cmd/jujud/ provisioning_ test.go provisioning_ test.go' provisioning_ test.go 2012-08-27 05:56:21 +0000 provisioning_ test.go 2012-08-29 17:42:03 +0000 Logf("discardin g unknown event %#v", op)
=== modified file 'cmd/jujud/
--- cmd/jujud/
+++ cmd/jujud/
@@ -86,7 +86,7 @@
}
c.
case <-time.After(2 * time.Second):
- c.Errorf("time out wating for operation")
+ c.Fatalf("time out wating for operation")
}
}
panic("not reached")