Documentation ¶
Index ¶
- Variables
- func Bootstrap(ctx environs.BootstrapContext, env environs.Environ, ...) (err error)
- func Destroy(env environs.Environ) error
- func EnsureBootstrapTools(ctx environs.BootstrapContext, env environs.Environ, series string, ...) (coretools.List, error)
- func GenerateSystemSSHKey(env environs.Environ) (privateKey string, err error)
- func StateInfo(env environs.Environ) (*state.Info, *api.Info, error)
- func SupportedArchitectures(env environs.Environ, imageConstraint *imagemetadata.ImageConstraint) ([]string, error)
- type SupportsUnitPlacementPolicy
Constants ¶
This section is empty.
Variables ¶
var FinishBootstrap = func(ctx environs.BootstrapContext, client ssh.Client, inst instance.Instance, machineConfig *cloudinit.MachineConfig) error { interrupted := make(chan os.Signal, 1) ctx.InterruptNotify(interrupted) defer ctx.StopInterruptNotify(interrupted) nonceFile := utils.ShQuote(path.Join(machineConfig.DataDir, cloudinit.NonceFile)) checkNonceCommand := fmt.Sprintf(` noncefile=%s if [ ! -e "$noncefile" ]; then echo "$noncefile does not exist" >&2 exit 1 fi content=$(cat $noncefile) if [ "$content" != %s ]; then echo "$noncefile contents do not match machine nonce" >&2 exit 1 fi `, nonceFile, utils.ShQuote(machineConfig.MachineNonce)) addr, err := waitSSH( ctx, interrupted, client, checkNonceCommand, inst, machineConfig.Config.BootstrapSSHOpts(), ) if err != nil { return err } cloudcfg := coreCloudinit.New() if err := cloudinit.ConfigureJuju(machineConfig, cloudcfg); err != nil { return err } configScript, err := sshinit.ConfigureScript(cloudcfg) if err != nil { return err } script := shell.DumpFileOnErrorScript(machineConfig.CloudInitOutputLog) + configScript return sshinit.RunConfigureScript(script, sshinit.ConfigureParams{ Host: "ubuntu@" + addr, Client: client, Config: cloudcfg, ProgressWriter: ctx.GetStderr(), }) }
FinishBootstrap completes the bootstrap process by connecting to the instance via SSH and carrying out the cloud-config.
Note: FinishBootstrap is exposed so it can be replaced for testing.
var LongAttempt = utils.AttemptStrategy{ Total: 3 * time.Minute, Delay: 1 * time.Second, }
A request may fail to due "eventual consistency" semantics, which should resolve fairly quickly. These delays are specific to the provider and best tuned there. Other requests fail due to a slow state transition (e.g. an instance taking a while to release a security group after termination). If you need to poll for the latter kind, use LongAttempt.
var ShortAttempt = utils.AttemptStrategy{ Total: 5 * time.Second, Delay: 200 * time.Millisecond, }
Use ShortAttempt to poll for short-term events. TODO: This may need tuning for different providers (or even environments).
Functions ¶
func Bootstrap ¶
func Bootstrap(ctx environs.BootstrapContext, env environs.Environ, args environs.BootstrapParams) (err error)
Bootstrap is a common implementation of the Bootstrap method defined on environs.Environ; we strongly recommend that this implementation be used when writing a new provider.
func Destroy ¶
Destroy is a common implementation of the Destroy method defined on environs.Environ; we strongly recommend that this implementation be used when writing a new provider.
func EnsureBootstrapTools ¶
func EnsureBootstrapTools(ctx environs.BootstrapContext, env environs.Environ, series string, arch *string) (coretools.List, error)
EnsureBootstrapTools finds tools, syncing with an external tools source as necessary; it then selects the newest tools to bootstrap with, and sets agent-version.
func GenerateSystemSSHKey ¶
GenerateSystemSSHKey creates a new key for the system identity. The authorized_keys in the environment config is updated to include the public key for the generated key.
func StateInfo ¶
StateInfo is a reusable implementation of Environ.StateInfo, available to providers that also use the other functionality from this file.
func SupportedArchitectures ¶
func SupportedArchitectures(env environs.Environ, imageConstraint *imagemetadata.ImageConstraint) ([]string, error)
SupportedArchitectures returns all the image architectures for env matching the constraints.
Types ¶
type SupportsUnitPlacementPolicy ¶
type SupportsUnitPlacementPolicy struct{}
SupportsUnitPlacementPolicy provides an implementation of SupportsUnitPlacement that never returns an error, and is intended for embedding in environs.Environ implementations.
func (*SupportsUnitPlacementPolicy) SupportsUnitPlacement ¶
func (*SupportsUnitPlacementPolicy) SupportsUnitPlacement() error