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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/agent/agent.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:
20
20
        "github.com/juju/utils"
21
21
        "github.com/juju/utils/series"
22
22
        "github.com/juju/utils/shell"
 
23
        "github.com/juju/version"
23
24
 
24
25
        "github.com/juju/juju/api"
25
26
        "github.com/juju/juju/apiserver/params"
27
28
        "github.com/juju/juju/mongo"
28
29
        "github.com/juju/juju/network"
29
30
        "github.com/juju/juju/state/multiwatcher"
30
 
        "github.com/juju/juju/version"
31
31
)
32
32
 
33
33
var logger = loggo.GetLogger("juju.agent")
37
37
        // dir that, if it exists, will cause a machine agent to uninstall
38
38
        // when it receives the termination signal.
39
39
        UninstallAgentFile = "uninstall-agent"
 
40
 
 
41
        // BootstrapNonce is used as a nonce for the initial controller machine.
 
42
        BootstrapNonce = "user-admin:bootstrap"
 
43
 
 
44
        // BootstrapMachineId is the ID of the initial controller machine.
 
45
        BootstrapMachineId = "0"
40
46
)
41
47
 
42
48
// These are base values used for the corresponding defaults.
570
576
        }
571
577
        var addrs []string
572
578
        for _, serverHostPorts := range servers {
573
 
                // Try the preferred approach first.
574
 
                serverHP, ok := network.SelectHostPortBySpace(serverHostPorts, network.DefaultSpace)
575
 
                if ok {
576
 
                        addrs = append(addrs, serverHP.NetAddr())
577
 
                } else {
578
 
                        // Fallback to the legacy approach.
579
 
                        hps := network.SelectInternalHostPorts(serverHostPorts, false)
580
 
                        addrs = append(addrs, hps...)
581
 
                }
 
579
                hps := network.SelectInternalHostPorts(serverHostPorts, false)
 
580
                addrs = append(addrs, hps...)
582
581
        }
583
582
        c.apiDetails.addresses = addrs
584
583
        logger.Infof("API server address details %q written to agent config as %q", servers, addrs)