~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/provisioner/provisioner_task.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
        "github.com/juju/juju/watcher"
34
34
        "github.com/juju/juju/worker"
35
35
        "github.com/juju/juju/worker/catacomb"
 
36
        "github.com/juju/juju/wrench"
36
37
        "github.com/juju/version"
37
38
)
38
39
 
203
204
                        continue
204
205
                }
205
206
                machine := machines[i]
206
 
                if err := machine.SetStatus(status.StatusPending, "", nil); err != nil {
 
207
                if err := machine.SetStatus(status.Pending, "", nil); err != nil {
207
208
                        logger.Errorf("cannot reset status of machine %q: %v", statusResult.Id, err)
208
209
                        continue
209
210
                }
396
397
                        logger.Infof("cannot get machine id:%s, details:%v, err:%v", machine.Id(), machine, err)
397
398
                        return None, nil
398
399
                }
399
 
                if machineStatus == status.StatusPending {
 
400
                if machineStatus == status.Pending {
400
401
                        logger.Infof("found machine pending provisioning id:%s, details:%v", machine.Id(), machine)
401
402
                        return Pending, nil
402
403
                }
465
466
        if len(instances) == 0 {
466
467
                return nil
467
468
        }
 
469
        if wrench.IsActive("provisioner", "stop-instances") {
 
470
                return errors.New("wrench in the works")
 
471
        }
 
472
 
468
473
        ids := make([]instance.Id, len(instances))
469
474
        for i, inst := range instances {
470
475
                ids[i] = inst.Id()
680
685
 
681
686
func (task *provisionerTask) setErrorStatus(message string, machine *apiprovisioner.Machine, err error) error {
682
687
        logger.Errorf(message, machine, err)
683
 
        if err1 := machine.SetStatus(status.StatusError, err.Error(), nil); err1 != nil {
 
688
        if err1 := machine.SetStatus(status.Error, err.Error(), nil); err1 != nil {
684
689
                // Something is wrong with this machine, better report it back.
685
690
                return errors.Annotatef(err1, "cannot set error status for machine %q", machine)
686
691
        }
707
712
 
708
713
                logger.Warningf("%v", errors.Annotate(err, "starting instance"))
709
714
                retryMsg := fmt.Sprintf("will retry to start instance in %v", task.retryStartInstanceStrategy.retryDelay)
710
 
                if err2 := machine.SetStatus(status.StatusPending, retryMsg, nil); err2 != nil {
 
715
                if err2 := machine.SetStatus(status.Pending, retryMsg, nil); err2 != nil {
711
716
                        logger.Errorf("%v", err2)
712
717
                }
713
718
                logger.Infof(retryMsg)