~james-page/ubuntu/wily/juju-core/mir-fixes

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/state/status.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-03-28 08:58:42 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20140328085842-cyzrgc120bdfxwj0
Tags: 1.17.7-0ubuntu1
* New upstream point release, including fixes for:
  - no debug log with all providers on Ubuntu 14.04 (LP: #1294776).
* d/control: Add cpu-checker dependency to juju-local (LP: #1297077).

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
// validateSet returns an error if the statusDoc does not represent a sane
28
28
// SetStatus operation.
29
 
func (doc statusDoc) validateSet() error {
 
29
func (doc statusDoc) validateSet(allowPending bool) error {
30
30
        if !doc.Status.Valid() {
31
31
                return fmt.Errorf("cannot set invalid status %q", doc.Status)
32
32
        }
33
33
        switch doc.Status {
34
 
        case params.StatusPending, params.StatusDown:
 
34
        case params.StatusPending:
 
35
                if !allowPending {
 
36
                        return fmt.Errorf("cannot set status %q", doc.Status)
 
37
                }
 
38
        case params.StatusDown:
35
39
                return fmt.Errorf("cannot set status %q", doc.Status)
36
40
        case params.StatusError:
37
41
                if doc.StatusInfo == "" {