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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/provider/cloudsigma/config.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
        "github.com/altoros/gosigma"
8
8
        "github.com/juju/errors"
9
9
        "github.com/juju/schema"
10
 
        "github.com/juju/utils"
11
10
 
12
11
        "github.com/juju/juju/environs/config"
13
12
)
35
34
        "endpoint",
36
35
}
37
36
 
38
 
func prepareConfig(cfg *config.Config) (*config.Config, error) {
39
 
        // Turn an incomplete config into a valid one, if possible.
40
 
        attrs := cfg.AllAttrs()
41
 
 
42
 
        if _, ok := attrs["uuid"]; !ok {
43
 
                uuid, err := utils.NewUUID()
44
 
                if err != nil {
45
 
                        return nil, errors.Trace(err)
46
 
                }
47
 
                attrs["uuid"] = uuid.String()
48
 
        }
49
 
 
50
 
        return cfg.Apply(attrs)
51
 
}
52
 
 
53
37
func validateConfig(cfg *config.Config, old *environConfig) (*environConfig, error) {
54
38
        // Check sanity of juju-level fields.
55
39
        var oldCfg *config.Config