1
// Copyright 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
10
"launchpad.net/juju-core/instance"
11
"launchpad.net/juju-core/utils"
14
// A request may fail to due "eventual consistency" semantics, which
15
// should resolve fairly quickly. These delays are specific to the provider
16
// and best tuned there.
17
// Other requests fail due to a slow state transition (e.g. an instance taking
18
// a while to release a security group after termination). If you need to
19
// poll for the latter kind, use LongAttempt.
20
var LongAttempt = utils.AttemptStrategy{
21
Total: 3 * time.Minute,
22
Delay: 1 * time.Second,
25
// WaitDNSName is an implementation that the providers can use. It builds on
26
// the provider's implementation of Instance.DNSName.
27
func WaitDNSName(inst instance.Instance) (string, error) {
28
for a := LongAttempt.Start(); a.Next(); {
29
name, err := inst.DNSName()
30
if err == nil || err != instance.ErrNoDNSName {
34
return "", fmt.Errorf("timed out trying to get DNS address for %v", inst.Id())