Merge lp:~thumper/juju-core/fix-local-bootstrap-json into lp:~go-bot/juju-core/trunk
Proposed by
Tim Penhey
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | Tim Penhey | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~thumper/juju-core/fix-local-bootstrap-json | ||||
Merge into: | lp:~go-bot/juju-core/trunk | ||||
Diff against target: |
53 lines (+18/-4) 2 files modified
provider/local/config.go (+4/-4) provider/local/config_test.go (+14/-0) |
||||
To merge this branch: | bzr merge lp:~thumper/juju-core/fix-local-bootstrap-json | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+187955@code.launchpad.net |
Commit message
Fix local provider bootstrap.
The environment configuration was being serialized
through JSON, which was coercing the integer values
to float64.
The validation schema checks were strictly looking for
integers. This has now been changed to ForceInt.
Test added.
Description of the change
Fix local provider bootstrap.
The environment configuration was being serialized
through JSON, which was coercing the integer values
to float64.
The validation schema checks were strictly looking for
integers. This has now been changed to ForceInt.
Test added.
To post a comment you must log in.
Reviewers: mp+187955_ code.launchpad. net,
Message:
Please take a look.
Description:
Fix local provider bootstrap.
The environment configuration was being serialized
through JSON, which was coercing the integer values
to float64.
The validation schema checks were strictly looking for
integers. This has now been changed to ForceInt.
Test added.
https:/ /code.launchpad .net/~thumper/ juju-core/ fix-local- bootstrap/ +merge/ 187955
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/14006043/
Affected files (+20, -4 lines): local/config. go local/config_ test.go
A [revision details]
M provider/
M provider/
Index: [revision details] 20130926184157- 5d305cr4rb895ln t
=== 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: tarmac-
+New revision: <email address hidden>
Index: provider/ local/config. go local/config. go' local/config. go 2013-07-17 02:40:31 +0000 local/config. go 2013-09-26 23:34:07 +0000 storage- port": schema.Int(), storage- port": schema.ForceInt(),
=== modified file 'provider/
--- provider/
+++ provider/
@@ -21,8 +21,8 @@
configFields = schema.Fields{
"root-dir": schema.String(),
"bootstrap-ip": schema.String(),
- "storage-port": schema.Int(),
- "shared-
+ "storage-port": schema.ForceInt(),
+ "shared-
}
// The port defaults below are not entirely arbitrary. Local user web
// frameworks often use 8000 or 8080, so I didn't want to use either of
@@ -102,11 +102,11 @@
}
func (c *environConfig) storagePort() int { "storage- port"]. (int64) ) "storage- port"]. (int)
- return int(c.attrs[
+ return c.attrs[
}
func (c *environConfig) sharedStoragePort() int { "shared- storage- port"]. (int64) ) "shared- storage- port"]. (int)
- return int(c.attrs[
+ return c.attrs[
}
func (c *environConfig) storageAddr() string {
Index: provider/ local/config_ test.go local/config_ test.go' local/config_ test.go 2013-09-12 14:16:48 +0000 local/config_ test.go 2013-09-26 23:34:58 +0000 unknownAttrs[ "root-dir" ], gc.Equals, expectedRootDir)
=== modified file 'provider/
--- provider/
+++ provider/
@@ -89,6 +89,20 @@
c.Assert(
}
+func (s *configSuite) TestValidateCon figWithFloatPor t(c *gc.C) { lues() "storage- port"] = float64(8040) New(config. NoDefaults, values) Validate( testConfig, nil) trs() unknownAttrs[ "storage- port"], gc.Equals, int(8040)) local.ConfigNam espace( testConfig) , gc.Equals, "tester-test")
+ // When the config values get serialized through JSON, the integers
+ // get coerced to float64 values. The parsing needs to handle this.
+ values := minimalConfigVa
+ values[
+ testConfig, err := config.
+ c.Assert(err, gc.IsNil)
+
+ valid, err := local.Provider.
+ c.Assert(err, gc.IsNil)
+ unknownAttrs := valid.UnknownAt
+ c.Assert(
+}
+
func (s *configSuite) TestNamespace(c *gc.C) {
testConfig := minimalConfig(c)
c.Assert(