Merge lp://staging/~waigani/juju-core/validate-environ-config into lp://staging/~go-bot/juju-core/trunk
Proposed by
Jesse Meek
Status: | Work in progress |
---|---|
Proposed branch: | lp://staging/~waigani/juju-core/validate-environ-config |
Merge into: | lp://staging/~go-bot/juju-core/trunk |
Diff against target: |
131 lines (+36/-28) 5 files modified
cmd/juju/environment.go (+7/-11) cmd/juju/environment_test.go (+1/-1) environs/config.go (+22/-0) state/apiserver/client/client.go (+4/-15) state/apiserver/keymanager/keymanager.go (+2/-1) |
To merge this branch: | bzr merge lp://staging/~waigani/juju-core/validate-environ-config |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+205880@code.staging.launchpad.net |
Description of the change
Fix lp:1168744 validate config
Add new function to environs, ValidateConfig, which makes a new config by applying config args to oldConfig and validating via environ provider specific validator.
To post a comment you must log in.
Unmerged revisions
- 2314. By Jesse Meek
-
Cleaned up code as per axw's and wollyworld's feedback
- 2313. By Jesse Meek
-
removed some whitespace
- 2312. By Jesse Meek
-
Added a new function ValidateConfig to environ package which makes new config by applying config args to oldConfig and validating via environ provider specific validator.
Reviewers: mp+205880_ code.launchpad. net,
Message:
Please take a look.
Description:
Fix lp:1168744 validate config
Add new function to environs, ValidateConfig, which makes a new config
by applying config args to oldConfig and validating via environ provider
specific validator.
https:/ /code.launchpad .net/~waigani/ juju-core/ validate- environ- config/ +merge/ 205880
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/62400043/
Affected files (+40, -28 lines): environment. go environment_ test.go /client/ client. go /keymanager/ keymanager. go
A [revision details]
M cmd/juju/
M cmd/juju/
M environs/config.go
M state/apiserver
M state/apiserver
Index: [revision details] 20140211064343- d5yn0b3om93nuec j
=== 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.go config. go' oldConfig *config.Config, args map[string] interface{ }) Apply(args) Validate( newConfig, oldConfig)
=== modified file 'environs/
--- environs/config.go 2014-02-10 03:29:45 +0000
+++ environs/config.go 2014-02-12 21:01:39 +0000
@@ -262,3 +262,23 @@
}
return cfg, nil
}
+
+//Make new config by applying config args to oldConfig and validating via
environ provider specific validator
+func ValidateConfig(
(newProviderConfig *config.Config, err error) {
+ // Apply the attributes specified for the command to the state config.
+ newConfig, err := oldConfig.
+ if err != nil {
+ return nil, err
+ }
+ env, err := New(oldConfig)
+ if err != nil {
+ return nil, err
+ }
+ // Now validate this new config against the existing config via the
provider.
+ provider := env.Provider()
+ newProviderConfig, err = provider.
+ if err != nil {
+ return nil, err
+ }
+ return newProviderConfig, err
+}
Index: cmd/juju/ environment. go environment. go' environment. go 2013-12-17 18:21:26 +0000 environment. go 2014-02-12 01:16:10 +0000 net/gnuflag"
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -10,6 +10,7 @@
"launchpad.
"launchpad. net/juju- core/cmd" net/juju- core/environs" net/juju- core/juju" net/juju- core/state/ api/params" Apply(c. values) Provider( ) Validate( newConfig, oldConfig) ValidateConfig( oldConfig, c.values) SetEnvironConfi g(newProviderCo nfig, oldConfig)
+ "launchpad.
"launchpad.
"launchpad.
)
@@ -169,17 +170,14 @@
if err != nil {
return err
}
- // Apply the attributes specified for the command to the state config.
- newConfig, err := oldConfig.
- if err != nil {
- return err
- }
- // Now validate this new config against the existing config via the
provider.
- provider := conn.Environ.
- newProviderConfig, err := provider.
- if err != nil {
- return err
- }
+
+ // Apply the attributes specified for the command to the state config and
+ // validate this new config against the existing config via the provider.
+ newProviderConfig, err := environs.
+ if err != nil {
+ return err
+ }
+
// Now try to apply the new validated config.
return conn.State.
}
Index: cmd/juju/ environment_ test.go
=== ...