Merge lp:~thumper/juju-core/consolidate-bootstrap-initial-check into lp:~go-bot/juju-core/trunk
Proposed by
Tim Penhey
Status: | Merged |
---|---|
Approved by: | Tim Penhey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1389 |
Proposed branch: | lp:~thumper/juju-core/consolidate-bootstrap-initial-check |
Merge into: | lp:~go-bot/juju-core/trunk |
Prerequisite: | lp:~thumper/juju-core/consolidate-bootstrap-state |
Diff against target: |
170 lines (+48/-42) 5 files modified
environs/bootstrap.go (+26/-0) environs/dummy/environs.go (+6/-1) environs/ec2/ec2.go (+1/-18) environs/maas/environ.go (+13/-4) environs/openstack/provider.go (+2/-19) |
To merge this branch: | bzr merge lp:~thumper/juju-core/consolidate-bootstrap-initial-check |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John A Meinel | Approve | ||
Review via email:
|
Commit message
Make a common verification function for bootstrap
Description of the change
Make a common verification function for bootstrap
All the providers did the same pre-bootstrap verification
(or should have in the case of maas). As discussed in Oakland,
I pulled the common code out into a shared function.
To post a comment you must log in.
Reviewers: mp+172715_ code.launchpad. net,
Message:
Please take a look.
Description:
Make a common verification function for bootstrap
All the providers did the same pre-bootstrap verification
(or should have in the case of maas). As discussed in Oakland,
I pulled the common code out into a shared function.
https:/ /code.launchpad .net/~thumper/ juju-core/ consolidate- bootstrap- initial- check/+ merge/172715
Requires: /code.launchpad .net/~thumper/ juju-core/ consolidate- bootstrap- state/+ merge/172701
https:/
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/10888044/
Affected files: bootstrap. go dummy/environs. go maas/environ. go openstack/ provider. go
A [revision details]
M environs/
M environs/
M environs/ec2/ec2.go
M environs/
M environs/
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: environs/ bootstrap. go bootstrap. go' bootstrap. go 2013-07-02 23:28:43 +0000 bootstrap. go 2013-07-03 01:16:51 +0000
=== modified file 'environs/
--- environs/
+++ environs/
@@ -7,6 +7,8 @@
"fmt"
"launchpad. net/juju- core/constraint s" net/juju- core/errors" net/juju- core/utils"
+ "launchpad.
+ "launchpad.
)
// Bootstrap bootstraps the given environment. The supplied constraints are Bootstrap( cons) Init(env Environ, shortAttempt utils.AttemptSt rategy) Start() ; a.Next(); { te(env. Storage( )) "environment is already bootstrapped") IsNotFoundError (err) { env.Storage( ))
@@ -33,3 +35,32 @@
}
return environ.
}
+
+// VerifyBootstrapInit does the common initial check inside bootstrap to
+// confirm that the environment isn't already running, and that the storage
+// works.
+func VerifyBootstrap
error {
+ var err error
+
+ // If the state file exists, it might actually have just been
+ // removed by Destroy, and eventual consistency has not caught
+ // up yet, so we retry to verify if that is happening.
+ for a := shortAttempt.
+ _, err = LoadProviderSta
+ if err != nil {
+ break
+ }
+ }
+ if err == nil {
+ return fmt.Errorf(
+ }
+ if !errors.
+ return fmt.Errorf("cannot query old bootstrap state: %v", err)
+ }
+
+ err = VerifyStorage(
+ if err != nil {
+ return err
+ }
+ return nil
+}
Index: environs/ dummy/environs. go dummy/environs. go' dummy/environs. go 2013-06-30 23:37:23 +0000 dummy/environs. go 2013-07-03 01:23:46 +0000 ).CACert( ); !ok { VerifyStorage( e.Storage( )); err != nil { rategy{ VerifyBootstrap Init(e, shortAttempt); err != nil {
=== modified file 'environs/
--- environs/
+++ environs/
@@ -433,7 +433,12 @@
if _, ok := e.Config(
return fmt.Errorf("no CA certificate in environment configuration")
}
- if err := environs.
+
+ var shortAttempt = utils.AttemptSt
+ Total: 200 * time.Millisecond,
+ Delay: 10 * time.Millisecond,
+ }
+ if err := environs.
return err
}
Index: environs/ec2/ec2.go ec2/ec2. go' ec2/ec2. ...
=== modified file 'environs/
--- environs/ec2/ec2.go 2013-07-02 23:15:14 +0000
+++ environs/