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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/environs/utils.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:
73
73
        if err != nil {
74
74
                return nil, err
75
75
        }
76
 
        defaultSpaceAddr, ok := network.SelectAddressBySpace(addrs, network.DefaultSpace)
77
 
        if ok {
78
 
                addrs = []network.Address{defaultSpaceAddr}
79
 
                logger.Debugf("selected %q as API address in space %q", defaultSpaceAddr.Value, network.DefaultSpace)
80
 
        } else {
81
 
                logger.Warningf("using all API addresses (cannot pick by space %q): %+v", network.DefaultSpace, addrs)
82
 
        }
83
76
        config := env.Config()
84
77
        cert, hasCert := config.CACert()
85
78
        if !hasCert {
89
82
        apiAddrs := network.HostPortsToStrings(
90
83
                network.AddressesWithPort(addrs, apiPort),
91
84
        )
92
 
        uuid, uuidSet := config.UUID()
93
 
        if !uuidSet {
94
 
                return nil, errors.New("config has no UUID")
95
 
        }
96
 
        modelTag := names.NewModelTag(uuid)
 
85
        modelTag := names.NewModelTag(config.UUID())
97
86
        apiInfo := &api.Info{Addrs: apiAddrs, CACert: cert, ModelTag: modelTag}
98
87
        return apiInfo, nil
99
88
}