Merge lp:~axwalk/juju-core/lp1239550-check-jenv-consistency into lp:~go-bot/juju-core/trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~axwalk/juju-core/lp1239550-check-jenv-consistency |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
97 lines (+36/-4) 1 file modified
environs/open.go (+36/-4) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/lp1239550-check-jenv-consistency |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+191748@code.launchpad.net |
Description of the change
environs: warn if .jenv/env.yaml are inconsistent
Changes in environments.yaml do not take effect
for an environment that has already been prepared.
In some cases, it might not be obvious to a user
that the environment is prepared, and that changes
will not take effect. e.g.:
- User called sync-tools, then modified env.yaml,
then bootstrapped.
- User bootstrapped, bootstrap failed, then modified
env.yaml and tried again. We could remove the
.jenv file on failure, but we can't guarantee
juju won't die before doing so.
- User is bootstrapping the null provider; since
destroy-
must remove the .jenv file manually. It's easy to
forget to do that.
We now log a warning if any values have been
changed in environments.yaml after preparing,
and provide some direction on what to do.
Also: don't call Prepare for config retrieved from
the config store (i.e. already prepared config).
Fixes #1239550
Unmerged revisions
- 1995. By Andrew Wilkins
-
environs: warn if .jenv/env.yaml are inconsistent
Changes in environments.yaml do not take effect
for an environment that has already been prepared.
In some cases, it might not be obvious to a user
that the environment is prepared, and that changes
will not take effect. e.g.:
- User called sync-tools, then modified env.yaml,
then bootstrapped.
- User bootstrapped, bootstrap failed, then modified
env.yaml and tried again. We could remove the
.jenv file on failure, but we can't guarantee
juju won't die before doing so.
- User is bootstrapping the null provider; since
destroy-environment is not implemented, the user
must remove the .jenv file manually. It's easy to
forget to do that.We now log a warning if any values have been
changed in environments.yaml after preparing,
and provide some direction on what to do.Also: don't call Prepare for config retrieved from
the config store (i.e. already prepared config).Fixes #1239550
Reviewers: mp+191748_ code.launchpad. net,
Message:
Please take a look.
Description:
environs: warn if .jenv/env.yaml are inconsistent
Changes in environments.yaml do not take effect environment is not implemented, the user
for an environment that has already been prepared.
In some cases, it might not be obvious to a user
that the environment is prepared, and that changes
will not take effect. e.g.:
- User called sync-tools, then modified env.yaml,
then bootstrapped.
- User bootstrapped, bootstrap failed, then modified
env.yaml and tried again. We could remove the
.jenv file on failure, but we can't guarantee
juju won't die before doing so.
- User is bootstrapping the null provider; since
destroy-
must remove the .jenv file manually. It's easy to
forget to do that.
We now log a warning if any values have been
changed in environments.yaml after preparing,
and provide some direction on what to do.
Also: don't call Prepare for config retrieved from
the config store (i.e. already prepared config).
Fixes #1239550
https:/ /code.launchpad .net/~axwalk/ juju-core/ lp1239550- check-jenv- consistency/ +merge/ 191748
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/14880043/
Affected files (+38, -4 lines):
[revision details]
environs/open.go
Index: [revision details] 20131017053700- k2l0flmzzs7feuv 2
=== 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/open.go
=== modified file 'environs/open.go'
--- environs/open.go 2013-10-04 12:18:17 +0000
+++ environs/open.go 2013-10-18 03:39:49 +0000
@@ -6,6 +6,7 @@
import (
"fmt"
"io/ioutil"
+ "reflect"
"strings"
"time"
@@ -44,6 +45,28 @@ virons
ConfigFromEn
)
+// checkBootstrapC onfigConsistenc y checks that the bootstrap configuration onfigConsistenc y(infoConfig, environsConfig AllAttrs( ) AllAttrs( ) { ttrs[k] ; ok { DeepEqual( v, v2) { Warningf( "config %q was changed in environments.yaml from %q Warningf( `changes in environments.yaml will not take effect after /bu...
+// in the store (.jenv) is consistent with the configuration in
+// environments.yaml, logging warnings for each changed value.
+func checkBootstrapC
*config.Config) {
+ if infoConfig == nil || environsConfig == nil {
+ return
+ }
+ environsConfigAttrs := environsConfig.
+ var changed bool
+ for k, v := range infoConfig.
+ if v2, ok := environsConfigA
+ if !reflect.
+ logger.
to %q", k, v, v2)
+ changed = true
+ }
+ }
+ }
+ if changed {
+ logger.
bootstrapping. Update %s.jenv, revert environments.yaml, or
destroy-environment and re-bootstrap`, infoConfig.Name())
+ }
+}
+
// ConfigForName returns the configuration for the environment with the
// given name from the default environments file. If the name is blank,
// the default environment will be used. If the configuration is not
@@ -62,6 +85,7 @@
if name == "" {
name = envs.Default
}
+ environsCfg, err := envs.Config(name)
// TODO(rog) 2013-10-04 https:/