manual

package
v0.0.0-...-2608902 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2016 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckProvisioned = checkProvisioned

CheckProvisioned checks if any juju init service already exist on the host machine.

View Source
var DetectSeriesAndHardwareCharacteristics = detectSeriesAndHardwareCharacteristics

DetectSeriesAndHardwareCharacteristics detects the OS series and hardware characteristics of the remote machine by connecting to the machine and executing a bash script.

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 HostAddress

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

HostAddress returns an network.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(icfg *instancecfg.InstanceConfig) (string, error)

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

Types

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

	// Client provides the API needed to provision the machines.
	Client ProvisioningClientAPI

	// 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

	*params.UpdateBehavior
}

type ProvisioningClientAPI

type ProvisioningClientAPI interface {
	AddMachines([]params.AddMachineParams) ([]params.AddMachinesResult, error)
	ForceDestroyMachines(machines ...string) error
	ProvisioningScript(params.ProvisioningScriptParams) (script string, err error)
}

ProvisioningClientAPI defines the methods that are needed for the manual provisioning of machines. An interface is used here to decouple the API consumer from the actual API implementation type.

Jump to

Keyboard shortcuts

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