~rogpeppe/juju-core/323-machineagent-api-client

« back to all changes in this revision

Viewing changes to environs/maas/environ.go

  • Committer: Tarmac
  • Author(s): Tim Penhey
  • Date: 2013-06-17 22:06:54 UTC
  • mfrom: (1274.3.10 instance-id)
  • Revision ID: tarmac-20130617220654-1d7y34f00629h8cv
[r=thumper] Move state.InstanceId to instance.Id

Very mechanical change, just imports, and occasional variable renames.

https://codereview.appspot.com/10325043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        if err != nil {
117
117
                return err
118
118
        }
119
 
        err = env.saveState(&bootstrapState{StateInstances: []state.InstanceId{inst.Id()}})
 
119
        err = env.saveState(&bootstrapState{StateInstances: []instance.Id{inst.Id()}})
120
120
        if err != nil {
121
121
                if err := env.releaseInstance(inst); err != nil {
122
122
                        log.Errorf("environs/maas: cannot release failed bootstrap instance: %v", err)
397
397
}
398
398
 
399
399
// Instances returns the instance.Instance objects corresponding to the given
400
 
// slice of state.InstanceId.  Similar to what the ec2 provider does,
 
400
// slice of instance.Id.  Similar to what the ec2 provider does,
401
401
// Instances returns nil if the given slice is empty or nil.
402
 
func (environ *maasEnviron) Instances(ids []state.InstanceId) ([]instance.Instance, error) {
 
402
func (environ *maasEnviron) Instances(ids []instance.Id) ([]instance.Instance, error) {
403
403
        if len(ids) == 0 {
404
404
                return nil, nil
405
405
        }
411
411
// If the some of the intances could not be found, it returns the instance
412
412
// that could be found plus the error environs.ErrPartialInstances in the error
413
413
// return.
414
 
func (environ *maasEnviron) instances(ids []state.InstanceId) ([]instance.Instance, error) {
 
414
func (environ *maasEnviron) instances(ids []instance.Id) ([]instance.Instance, error) {
415
415
        nodeListing := environ.getMAASClient().GetSubObject("nodes")
416
416
        filter := getSystemIdValues(ids)
417
417
        listNodeObjects, err := nodeListing.CallGet("list", filter)
463
463
        if err != nil {
464
464
                return fmt.Errorf("cannot get instances: %v", err)
465
465
        }
466
 
        found := make(map[state.InstanceId]bool)
 
466
        found := make(map[instance.Id]bool)
467
467
        for _, inst := range insts {
468
468
                found[inst.Id()] = true
469
469
        }