Merge lp://staging/~niemeyer/juju-core/new-state-builddb into lp://staging/~juju/juju-core/trunk
Proposed by
Gustavo Niemeyer
Status: | Merged |
---|---|
Merged at revision: | 584 |
Proposed branch: | lp://staging/~niemeyer/juju-core/new-state-builddb |
Merge into: | lp://staging/~juju/juju-core/trunk |
Diff against target: |
49 lines (+20/-4) 1 file modified
cmd/builddb/main.go (+20/-4) |
To merge this branch: | bzr merge lp://staging/~niemeyer/juju-core/new-state-builddb |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
The Go Language Gophers | Pending | ||
Review via email: mp+126537@code.staging.launchpad.net |
Description of the change
cmd/builddb: tweaks for new state
This also moves it from util/ to cmd/, which is fine now that
environs is building tools explicitly by their name when
shipping to an environment. util/ is gone.
To post a comment you must log in.
Reviewers: mp+126537_ code.launchpad. net,
Message:
Please take a look.
Description:
cmd/builddb: tweaks for new state
This also moves it from util/ to cmd/, which is fine now that
environs is building tools explicitly by their name when
shipping to an environment. util/ is gone.
https:/ /code.launchpad .net/~niemeyer/ juju-core/ new-state- builddb/ +merge/ 126537
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6567054/
Affected files:
A [revision details]
M cmd/builddb/main.go
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: cmd/builddb/main.go main.go' main.go 2012-09-21 14:08:45 +0000
=== modified file 'cmd/builddb/
--- util/builddb/
+++ cmd/builddb/main.go 2012-09-26 20:14:53 +0000
@@ -53,18 +53,26 @@
return err
}
- log.Printf("Waiting for unit to reach started status...") ess() Printf( "Remember to destroy the environment when you're done...")
+ log.Printf("Waiting for unit to reach %q status...", state.UnitStarted)
unit := units[0]
- status, _, err := unit.Status()
+ last, info, err := unit.Status()
if err != nil {
return err
}
- for status != state.UnitStarted {
+ logStatus(last, info)
+ for last != state.UnitStarted {
time.Sleep(2 * time.Second)
- status, _, err = unit.Status()
+ if err := unit.Refresh(); err != nil {
+ return err
+ }
+ status, info, err := unit.Status()
if err != nil {
return err
}
+ if status != last {
+ logStatus(status, info)
+ last = status
+ }
}
addr, err := unit.PublicAddr
if err != nil {
@@ -74,3 +82,11 @@
log.
return nil
}
+
+func logStatus(status state.UnitStatus, info string) {
+ if info == "" {
+ log.Printf("Unit status is %q", status)
+ } else {
+ log.Printf("Unit status is %q: %s", status, info)
+ }
+}