Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(135)

Delta Between Two Patch Sets: environs/maas/state.go

Issue 10500043: environ.StateInfo() for Azure provider. (Closed)
Left Patch Set: environ.StateInfo() for Azure provider. Created 11 years, 9 months ago
Right Patch Set: environ.StateInfo() for Azure provider. Created 11 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « environs/maas/environ.go ('k') | environs/openstack/provider.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2013 Canonical Ltd. 1 // Copyright 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package maas 4 package maas
5 5
6 import ( 6 import (
7 "bytes" 7 "bytes"
8 "fmt" 8 "fmt"
9 "io/ioutil" 9 "io/ioutil"
10 "launchpad.net/goyaml" 10 "launchpad.net/goyaml"
11 "launchpad.net/juju-core/instance" 11 "launchpad.net/juju-core/instance"
12 ) 12 )
13
14 // TODO: This entire file is duplicated between the EC2, OpenStack, MAAS,
15 // and Azure providers (bug 1195721).
13 16
14 const stateFile = "provider-state" 17 const stateFile = "provider-state"
15 18
16 // Persistent environment state. An environment needs to know what instances 19 // Persistent environment state. An environment needs to know what instances
17 // it manages. 20 // it manages.
18 type bootstrapState struct { 21 type bootstrapState struct {
19 StateInstances []instance.Id `yaml:"state-instances"` 22 StateInstances []instance.Id `yaml:"state-instances"`
20 } 23 }
21 24
22 // saveState writes the environment's state to the provider-state file stored 25 // saveState writes the environment's state to the provider-state file stored
(...skipping 18 matching lines...) Expand all
41 if err != nil { 44 if err != nil {
42 return nil, fmt.Errorf("error reading %q: %v", stateFile, err) 45 return nil, fmt.Errorf("error reading %q: %v", stateFile, err)
43 } 46 }
44 var state bootstrapState 47 var state bootstrapState
45 err = goyaml.Unmarshal(data, &state) 48 err = goyaml.Unmarshal(data, &state)
46 if err != nil { 49 if err != nil {
47 return nil, fmt.Errorf("error unmarshalling %q: %v", stateFile, err) 50 return nil, fmt.Errorf("error unmarshalling %q: %v", stateFile, err)
48 } 51 }
49 return &state, nil 52 return &state, nil
50 } 53 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b