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

« back to all changes in this revision

Viewing changes to environs/maas/instance.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:
7
7
        "launchpad.net/gomaasapi"
8
8
        "launchpad.net/juju-core/instance"
9
9
        "launchpad.net/juju-core/log"
10
 
        "launchpad.net/juju-core/state"
11
10
        "launchpad.net/juju-core/state/api/params"
12
11
)
13
12
 
18
17
 
19
18
var _ instance.Instance = (*maasInstance)(nil)
20
19
 
21
 
func (instance *maasInstance) Id() state.InstanceId {
 
20
func (mi *maasInstance) Id() instance.Id {
22
21
        // Use the node's 'resource_uri' value.
23
 
        return state.InstanceId((*instance.maasObject).URI().String())
 
22
        return instance.Id((*mi.maasObject).URI().String())
24
23
}
25
24
 
26
25
// refreshInstance refreshes the instance with the most up-to-date information
27
26
// from the MAAS server.
28
 
func (instance *maasInstance) refreshInstance() error {
29
 
        insts, err := instance.environ.Instances([]state.InstanceId{instance.Id()})
 
27
func (mi *maasInstance) refreshInstance() error {
 
28
        insts, err := mi.environ.Instances([]instance.Id{mi.Id()})
30
29
        if err != nil {
31
30
                return err
32
31
        }
33
32
        newMaasObject := insts[0].(*maasInstance).maasObject
34
 
        instance.maasObject = newMaasObject
 
33
        mi.maasObject = newMaasObject
35
34
        return nil
36
35
}
37
36