Merge lp:~axwalk/juju-core/config-defaults into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | Andrew Wilkins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2353 |
Proposed branch: | lp:~axwalk/juju-core/config-defaults |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
39 lines (+10/-1) 2 files modified
environs/config/config.go (+6/-1) environs/config/config_test.go (+4/-0) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/config-defaults |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+207609@code.launchpad.net |
Commit message
environs/config: fix optional values/defaults
We have config values which are optional for
backwards compatibility. In some cases these
should take on a different value to what the
default for a new config is. The way the defaults
map is currently constructed means that the
backwards-
the defaults.
Description of the change
environs/config: fix optional values/defaults
We have config values which are optional for
backwards compatibility. In some cases these
should take on a different value to what the
default for a new config is. The way the defaults
map is currently constructed means that the
backwards-
the defaults.
Reviewers: mp+207609_ code.launchpad. net,
Message:
Please take a look.
Description:
environs/config: fix optional values/defaults
We have config values which are optional for compatibility values always overwrite
backwards compatibility. In some cases these
should take on a different value to what the
default for a new config is. The way the defaults
map is currently constructed means that the
backwards-
the defaults.
https:/ /code.launchpad .net/~axwalk/ juju-core/ config- defaults/ +merge/ 207609
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/66920043/
Affected files (+12, -1 lines): config/ config. go config/ config_ test.go
A [revision details]
M environs/
M environs/
Index: [revision details] 20140220160904- 67ajnt8y3n3jd73 c
=== 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: environs/ config/ config. go config/ config. go' config/ config. go 2014-02-12 04:54:19 +0000 config/ config. go 2014-02-21 10:00:22 +0000
=== modified file 'environs/
--- environs/
+++ environs/
@@ -742,6 +742,9 @@
var defaults = allDefaults()
+// allDefaults returns a schema.Defaults that contains series" : DefaultSeries, addresses- delay": DefaultBootstra pSSHAddressesDe lay,
+// defaults to be used when creating a new config with
+// UseDefaults.
func allDefaults() schema.Defaults {
d := schema.Defaults{
"default-
@@ -756,7 +759,9 @@
"bootstrap-
}
for attr, val := range alwaysOptional {
- d[attr] = val
+ if _, ok := d[attr]; !ok {
+ d[attr] = val
+ }
}
return d
}
Index: environs/ config/ config_ test.go config/ config_ test.go' config/ config_ test.go 2014-02-12 04:54:19 +0000 config/ config_ test.go 2014-02-21 10:00:22 +0000 Attrs{" syslog- port": 42}, Attrs{" bootstrap- timeout" : 5},
=== modified file 'environs/
--- environs/
+++ environs/
@@ -1100,6 +1100,10 @@
about: "Cannot change the syslog-port from implicit-default to different
value",
new: testing.
err: `cannot change syslog-port from 514 to 42`,
+}, {
+ about: "Cannot change the bootstrap-timeout from implicit-default to
different value",
+ new: testing.
+ err: `cannot change bootstrap-timeout from 600 to 5`,
}}
func (*ConfigSuite) TestValidateCha nge(c *gc.C) {