~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/maas/environprovider.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:
10
10
        "github.com/juju/errors"
11
11
        "github.com/juju/gomaasapi"
12
12
        "github.com/juju/loggo"
13
 
        "github.com/juju/utils"
14
13
 
15
14
        "github.com/juju/juju/cloud"
16
15
        "github.com/juju/juju/environs"
52
51
        if found && oldName != "" {
53
52
                return nil, errAgentNameAlreadySet
54
53
        }
55
 
        uuid, err := utils.NewUUID()
56
 
        if err != nil {
57
 
                return nil, err
58
 
        }
59
 
        attrs["maas-agent-name"] = uuid.String()
 
54
        attrs["maas-agent-name"] = cfg.UUID()
60
55
        return cfg.Apply(attrs)
61
56
}
62
57
 
63
 
func (p maasEnvironProvider) PrepareForBootstrap(ctx environs.BootstrapContext, args environs.PrepareForBootstrapParams) (environs.Environ, error) {
 
58
// BootstrapConfig is specified in the EnvironProvider interface.
 
59
func (p maasEnvironProvider) BootstrapConfig(args environs.BootstrapConfigParams) (*config.Config, error) {
64
60
        // For MAAS, either:
65
61
        // 1. the endpoint from the cloud definition defines the MAAS server URL
66
62
        //    (if a full cloud definition had been set up)
90
86
        if err != nil {
91
87
                return nil, errors.Trace(err)
92
88
        }
 
89
        return p.PrepareForCreateEnvironment(cfg)
 
90
}
93
91
 
94
 
        cfg, err = p.PrepareForCreateEnvironment(cfg)
95
 
        if err != nil {
96
 
                return nil, err
97
 
        }
 
92
// PrepareForBootstrap is specified in the EnvironProvider interface.
 
93
func (p maasEnvironProvider) PrepareForBootstrap(ctx environs.BootstrapContext, cfg *config.Config) (environs.Environ, error) {
98
94
        env, err := p.Open(cfg)
99
95
        if err != nil {
100
96
                return nil, err