provision

package
Version: v0.0.0-...-51acebc Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDetectionFailed  = errors.New("OS type not recognized")
	ErrSSHCommandFailed = errors.New("SSH command failure")
	ErrNotImplemented   = errors.New("Runtime not implemented")
)

Functions

func ConfigureAuth

func ConfigureAuth(p Provisioner, authOptions auth.AuthOptions) error

func Register

func Register(name string, p *RegisteredProvisioner)

Types

type AiyaraProvisioner

type AiyaraProvisioner struct {
	OsReleaseInfo *OsRelease
	Driver        drivers.Driver
	SwarmOptions  swarm.SwarmOptions
	// contains filtered or unexported fields
}

func (*AiyaraProvisioner) CompatibleWithHost

func (provisioner *AiyaraProvisioner) CompatibleWithHost() bool

func (*AiyaraProvisioner) GenerateDockerOptions

func (provisioner *AiyaraProvisioner) GenerateDockerOptions(dockerPort int, authOptions auth.AuthOptions) (*DockerOptions, error)

func (*AiyaraProvisioner) GetDockerOptionsDir

func (provisioner *AiyaraProvisioner) GetDockerOptionsDir() string

func (*AiyaraProvisioner) GetDriver

func (provisioner *AiyaraProvisioner) GetDriver() drivers.Driver

func (*AiyaraProvisioner) Hostname

func (provisioner *AiyaraProvisioner) Hostname() (string, error)

func (*AiyaraProvisioner) Package

func (provisioner *AiyaraProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*AiyaraProvisioner) Provision

func (provisioner *AiyaraProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions) error

func (*AiyaraProvisioner) SSHCommand

func (provisioner *AiyaraProvisioner) SSHCommand(args ...string) (*exec.Cmd, error)

func (*AiyaraProvisioner) Service

func (provisioner *AiyaraProvisioner) Service(name string, action pkgaction.ServiceAction) error

func (*AiyaraProvisioner) SetHostname

func (provisioner *AiyaraProvisioner) SetHostname(hostname string) error

func (*AiyaraProvisioner) SetOsReleaseInfo

func (provisioner *AiyaraProvisioner) SetOsReleaseInfo(info *OsRelease)

type Boot2DockerProvisioner

type Boot2DockerProvisioner struct {
	OsReleaseInfo *OsRelease
	Driver        drivers.Driver
	SwarmOptions  swarm.SwarmOptions
}

func (*Boot2DockerProvisioner) CompatibleWithHost

func (provisioner *Boot2DockerProvisioner) CompatibleWithHost() bool

func (*Boot2DockerProvisioner) GenerateDockerOptions

func (provisioner *Boot2DockerProvisioner) GenerateDockerOptions(dockerPort int, authOptions auth.AuthOptions) (*DockerOptions, error)

func (*Boot2DockerProvisioner) GetDockerOptionsDir

func (provisioner *Boot2DockerProvisioner) GetDockerOptionsDir() string

func (*Boot2DockerProvisioner) GetDriver

func (provisioner *Boot2DockerProvisioner) GetDriver() drivers.Driver

func (*Boot2DockerProvisioner) Hostname

func (provisioner *Boot2DockerProvisioner) Hostname() (string, error)

func (*Boot2DockerProvisioner) Package

func (provisioner *Boot2DockerProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*Boot2DockerProvisioner) Provision

func (provisioner *Boot2DockerProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions) error

func (*Boot2DockerProvisioner) SSHCommand

func (provisioner *Boot2DockerProvisioner) SSHCommand(args ...string) (*exec.Cmd, error)

func (*Boot2DockerProvisioner) Service

func (provisioner *Boot2DockerProvisioner) Service(name string, action pkgaction.ServiceAction) error

func (*Boot2DockerProvisioner) SetHostname

func (provisioner *Boot2DockerProvisioner) SetHostname(hostname string) error

func (*Boot2DockerProvisioner) SetOsReleaseInfo

func (provisioner *Boot2DockerProvisioner) SetOsReleaseInfo(info *OsRelease)

type DockerOptions

type DockerOptions struct {
	EngineOptions     string
	EngineOptionsPath string
}

type OsRelease

type OsRelease struct {
	AnsiColor    string `osr:"ANSI_COLOR"`
	Name         string `osr:"NAME"`
	Version      string `osr:"VERSION"`
	Id           string `osr:"ID"`
	IdLike       string `osr:"ID_LIKE"`
	PrettyName   string `osr:"PRETTY_NAME"`
	VersionId    string `osr:"VERSION_ID"`
	HomeUrl      string `osr:"HOME_URL"`
	SupportUrl   string `osr:"SUPPORT_URL"`
	BugReportUrl string `osr:"BUG_REPORT_URL"`
}

Values in this struct must always be string or the reflection will not work properly.

func NewOsRelease

func NewOsRelease(contents []byte) (*OsRelease, error)

func (*OsRelease) ParseOsRelease

func (osr *OsRelease) ParseOsRelease(osReleaseContents []byte) error

type Provisioner

type Provisioner interface {
	// Create the files for the daemon to consume configuration settings (return struct of content and path)
	GenerateDockerOptions(dockerPort int, authOptions auth.AuthOptions) (*DockerOptions, error)

	// Get the directory where the settings files for docker are to be found
	GetDockerOptionsDir() string

	// Run a package action e.g. install
	Package(name string, action pkgaction.PackageAction) error

	// Get Hostname
	Hostname() (string, error)

	// Set hostname
	SetHostname(hostname string) error

	// Figure out if this is the right provisioner to use based on /etc/os-release info
	CompatibleWithHost() bool

	// Do the actual provisioning piece:
	//     1. Set the hostname on the instance.
	//     2. Install Docker if it is not present.
	//     3. Configure the daemon to accept connections over TLS.
	//     4. Copy the needed certificates to the server and local config dir.
	//     5. Configure / activate swarm if applicable.
	Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions) error

	// Perform action on a named service e.g. stop
	Service(name string, action pkgaction.ServiceAction) error

	// Get the driver which is contained in the provisioner.
	GetDriver() drivers.Driver

	// Short-hand for accessing an SSH command from the driver.
	SSHCommand(args ...string) (*exec.Cmd, error)

	// Set the OS Release info depending on how it's represented
	// internally
	SetOsReleaseInfo(info *OsRelease)
}

Distribution specific actions

func DetectProvisioner

func DetectProvisioner(d drivers.Driver) (Provisioner, error)

func NewAiyaraProvisioner

func NewAiyaraProvisioner(d drivers.Driver) Provisioner

func NewBoot2DockerProvisioner

func NewBoot2DockerProvisioner(d drivers.Driver) Provisioner

func NewUbuntuProvisioner

func NewUbuntuProvisioner(d drivers.Driver) Provisioner

type RegisteredProvisioner

type RegisteredProvisioner struct {
	New func(d drivers.Driver) Provisioner
}

Detection

type UbuntuProvisioner

type UbuntuProvisioner struct {
	OsReleaseInfo *OsRelease
	Driver        drivers.Driver
	SwarmOptions  swarm.SwarmOptions
	// contains filtered or unexported fields
}

func (*UbuntuProvisioner) CompatibleWithHost

func (provisioner *UbuntuProvisioner) CompatibleWithHost() bool

func (*UbuntuProvisioner) GenerateDockerOptions

func (provisioner *UbuntuProvisioner) GenerateDockerOptions(dockerPort int, authOptions auth.AuthOptions) (*DockerOptions, error)

func (*UbuntuProvisioner) GetDockerOptionsDir

func (provisioner *UbuntuProvisioner) GetDockerOptionsDir() string

func (*UbuntuProvisioner) GetDriver

func (provisioner *UbuntuProvisioner) GetDriver() drivers.Driver

func (*UbuntuProvisioner) Hostname

func (provisioner *UbuntuProvisioner) Hostname() (string, error)

func (*UbuntuProvisioner) Package

func (provisioner *UbuntuProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*UbuntuProvisioner) Provision

func (provisioner *UbuntuProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions) error

func (*UbuntuProvisioner) SSHCommand

func (provisioner *UbuntuProvisioner) SSHCommand(args ...string) (*exec.Cmd, error)

func (*UbuntuProvisioner) Service

func (provisioner *UbuntuProvisioner) Service(name string, action pkgaction.ServiceAction) error

func (*UbuntuProvisioner) SetHostname

func (provisioner *UbuntuProvisioner) SetHostname(hostname string) error

func (*UbuntuProvisioner) SetOsReleaseInfo

func (provisioner *UbuntuProvisioner) SetOsReleaseInfo(info *OsRelease)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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