manual

package
v0.0.0-...-732aecd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2014 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const BootstrapInstanceId = instance.Id(manualInstancePrefix)

Variables

View Source
var DetectSeriesAndHardwareCharacteristics = detectSeriesAndHardwareCharacteristics

Patch for testing.

View Source
var ErrProvisioned = errors.New("machine is already provisioned")

ErrProvisioned is returned by ProvisionMachine if the target machine has an existing machine agent.

Functions

func Bootstrap

func Bootstrap(args BootstrapArgs) (err error)

NewManualBootstrapEnviron wraps a LocalStorageEnviron with another which overrides the Bootstrap method; when Bootstrap is invoked, the specified host will be manually bootstrapped.

InitUbuntuUser is expected to have been executed successfully against the host being bootstrapped.

func HostAddress

func HostAddress(hostname string) (instance.Address, error)

HostAddress returns an instance.Address for the specified hostname, depending on whether it is an IP or a resolvable hostname. The address is given public scope.

func InitUbuntuUser

func InitUbuntuUser(host, login, authorizedKeys string, stdin io.Reader, stdout io.Writer) error

InitUbuntuUser adds the ubuntu user if it doesn't already exist, updates its ~/.ssh/authorized_keys, and enables passwordless sudo for it.

InitUbuntuUser will initially attempt to login as the ubuntu user, and verify that passwordless sudo is enabled; only if this is false will there be an attempt with the specified login.

authorizedKeys may be empty, in which case the file will be created and left empty.

stdin and stdout will be used for remote sudo prompts, if the ubuntu user must be created/updated.

func ProvisionMachine

func ProvisionMachine(args ProvisionMachineArgs) (machineId string, err error)

ProvisionMachine provisions a machine agent to an existing host, via an SSH connection to the specified host. The host may optionally be preceded with a login username, as in [user@]host.

On successful completion, this function will return the id of the state.Machine that was entered into state.

func ProvisioningScript

func ProvisioningScript(mcfg *cloudinit.MachineConfig) (string, error)

ProvisioningScript generates a bash script that can be executed on a remote host to carry out the cloud-init configuration.

Types

type BootstrapArgs

type BootstrapArgs struct {
	Host                    string
	DataDir                 string
	Environ                 LocalStorageEnviron
	PossibleTools           tools.List
	Context                 environs.BootstrapContext
	Series                  string
	HardwareCharacteristics *instance.HardwareCharacteristics
}

type LocalStorageEnviron

type LocalStorageEnviron interface {
	environs.Environ
	localstorage.LocalStorageConfig
}

LocalStorageEnviron is an Environ where the bootstrap node manages its own local storage.

type ProvisionMachineArgs

type ProvisionMachineArgs struct {
	// Host is the SSH host: [user@]host
	Host string

	// DataDir is the root directory for juju data.
	// If left blank, the default location "/var/lib/juju" will be used.
	DataDir string

	// EnvName is the name of the environment for which the machine will be provisioned.
	EnvName string

	// Tools to install on the machine. If nil, tools will be automatically
	// chosen using environs/tools FindInstanceTools.
	Tools *tools.Tools

	// Stdin is required to respond to sudo prompts,
	// and must be a terminal (except in tests)
	Stdin io.Reader

	// Stdout is required to present sudo prompts to the user.
	Stdout io.Writer

	// Stderr is required to present machine provisioning progress to the user.
	Stderr io.Writer
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL