common

package
v0.0.0-...-7c2cc88 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2015 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "packer.xenserver"

This is the common builder ID to all of these artifacts.

View Source
const KeyLeftShift uint = 0xFFE1

Variables

This section is empty.

Functions

func CommHost

func CommHost(state multistep.StateBag) (string, error)

func ExecuteGuestSSHCmd

func ExecuteGuestSSHCmd(state multistep.StateBag, cmd string) (stdout string, err error)

func ExecuteHostSSHCmd

func ExecuteHostSSHCmd(state multistep.StateBag, cmd string) (stdout string, err error)

func FindPort

func FindPort(portMin uint, portMax uint) (net.Listener, uint)

FindPort finds and starts listening on a port in the range [portMin, portMax] returns the listener and the port number on success, or nil, 0 on failure

func HTTPUpload

func HTTPUpload(import_url string, fh *os.File, state multistep.StateBag) (result *xsclient.XenAPIObject, err error)

func HimnSSHIP

func HimnSSHIP(state multistep.StateBag) (string, error)

func HimnSSHPort

func HimnSSHPort(state multistep.StateBag) (uint, error)

func InstanceConsoleLocation

func InstanceConsoleLocation(state multistep.StateBag) (string, error)

func InstanceSSHIP

func InstanceSSHIP(state multistep.StateBag) (string, error)

func InstanceSSHPort

func InstanceSSHPort(state multistep.StateBag) (uint, error)

func InstanceVNCIP

func InstanceVNCIP(state multistep.StateBag) (string, error)

func NewArtifact

func NewArtifact(dir string) (packer.Artifact, error)

func SSHAddress

func SSHAddress(state multistep.StateBag) (string, error)

func SSHConfigFunc

func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*gossh.ClientConfig, error)

func SSHLocalAddress

func SSHLocalAddress(state multistep.StateBag) (string, error)

func SSHPort

func SSHPort(state multistep.StateBag) (int, error)

Types

type CommonConfig

type CommonConfig struct {
	Username string `mapstructure:"remote_username"`
	Password string `mapstructure:"remote_password"`
	HostIp   string `mapstructure:"remote_host"`

	VMName        string   `mapstructure:"vm_name"`
	VMDescription string   `mapstructure:"vm_description"`
	SrName        string   `mapstructure:"sr_name"`
	FloppyFiles   []string `mapstructure:"floppy_files"`
	NetworkName   string   `mapstructure:"network_name"`

	HostPortMin uint `mapstructure:"host_port_min"`
	HostPortMax uint `mapstructure:"host_port_max"`

	BootCommand     []string `mapstructure:"boot_command"`
	ShutdownCommand string   `mapstructure:"shutdown_command"`

	RawBootWait string `mapstructure:"boot_wait"`
	BootWait    time.Duration

	ToolsIsoName string `mapstructure:"tools_iso_name"`

	HTTPDir     string `mapstructure:"http_directory"`
	HTTPPortMin uint   `mapstructure:"http_port_min"`
	HTTPPortMax uint   `mapstructure:"http_port_max"`

	//	SSHHostPortMin    uint   `mapstructure:"ssh_host_port_min"`
	//	SSHHostPortMax    uint   `mapstructure:"ssh_host_port_max"`
	SSHKeyPath  string `mapstructure:"ssh_key_path"`
	SSHPassword string `mapstructure:"ssh_password"`
	SSHPort     uint   `mapstructure:"ssh_port"`
	SSHUser     string `mapstructure:"ssh_username"`
	SSHConfig   `mapstructure:",squash"`

	RawSSHWaitTimeout string `mapstructure:"ssh_wait_timeout"`
	SSHWaitTimeout    time.Duration

	OutputDir string `mapstructure:"output_directory"`
	Format    string `mapstructure:"format"`
	KeepVM    string `mapstructure:"keep_vm"`
	IPGetter  string `mapstructure:"ip_getter"`
}

func (CommonConfig) GetISOSR

func (config CommonConfig) GetISOSR(client xsclient.XenAPIClient) (*xsclient.SR, error)

func (CommonConfig) GetSR

func (config CommonConfig) GetSR(client xsclient.XenAPIClient) (*xsclient.SR, error)

func (*CommonConfig) Prepare

func (c *CommonConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error

func (CommonConfig) ShouldKeepVM

func (c CommonConfig) ShouldKeepVM(state multistep.StateBag) bool

steps should check config.ShouldKeepVM first before cleaning up the VM

type IPSnooper

type IPSnooper struct {
	// contains filtered or unexported fields
}

func (IPSnooper) ServeHTTP

func (snooper IPSnooper) ServeHTTP(resp http.ResponseWriter, req *http.Request)

type InterruptedError

type InterruptedError struct{}

func (InterruptedError) Error

func (err InterruptedError) Error() string

type InterruptibleWait

type InterruptibleWait struct {
	Timeout time.Duration

	// optional:
	Predicate         func() (result bool, err error)
	PredicateInterval time.Duration
}

func (InterruptibleWait) Wait

func (wait InterruptibleWait) Wait(state multistep.StateBag) error

Wait waits for up to Timeout duration, checking an optional Predicate every PredicateInterval duration.

The first run of Predicate is immediately after Wait is called.
If the command is interrupted by the user, then an InterruptedError is returned.
If Predicate is not nil, a timeout leads to TimeoutError being returned, and a successful Predicate run leads to nil being returned.
If Predicate is nil, a timeout is not an error, and nil is returned.

type LocalArtifact

type LocalArtifact struct {
	// contains filtered or unexported fields
}

func (*LocalArtifact) BuilderId

func (*LocalArtifact) BuilderId() string

func (*LocalArtifact) Destroy

func (a *LocalArtifact) Destroy() error

func (*LocalArtifact) Files

func (a *LocalArtifact) Files() []string

func (*LocalArtifact) Id

func (*LocalArtifact) Id() string

func (*LocalArtifact) State

func (a *LocalArtifact) State(name string) interface{}

func (*LocalArtifact) String

func (a *LocalArtifact) String() string

type PredicateResult

type PredicateResult struct {
	// contains filtered or unexported fields
}

type SSHConfig

type SSHConfig struct {
	Comm communicator.Config `mapstructure:",squash"`

	SSHHostPortMin    uint `mapstructure:"ssh_host_port_min"`
	SSHHostPortMax    uint `mapstructure:"ssh_host_port_max"`
	SSHSkipNatMapping bool `mapstructure:"ssh_skip_nat_mapping"`

	// These are deprecated, but we keep them around for BC
	// TODO(@mitchellh): remove
	SSHKeyPath     string        `mapstructure:"ssh_key_path"`
	SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout"`
}

func (*SSHConfig) Prepare

func (c *SSHConfig) Prepare(ctx *interpolate.Context) []error

type StepAttachVdi

type StepAttachVdi struct {
	VdiUuidKey string
	VdiType    xsclient.VDIType
	// contains filtered or unexported fields
}

func (*StepAttachVdi) Cleanup

func (s *StepAttachVdi) Cleanup(state multistep.StateBag)

func (*StepAttachVdi) Run

type StepBootWait

type StepBootWait struct{}

func (*StepBootWait) Cleanup

func (s *StepBootWait) Cleanup(state multistep.StateBag)

func (*StepBootWait) Run

type StepDetachVdi

type StepDetachVdi struct {
	VdiUuidKey string
}

func (*StepDetachVdi) Cleanup

func (s *StepDetachVdi) Cleanup(state multistep.StateBag)

func (*StepDetachVdi) Run

type StepExport

type StepExport struct{}

func (StepExport) Cleanup

func (StepExport) Cleanup(state multistep.StateBag)

func (StepExport) Run

type StepFindVdi

type StepFindVdi struct {
	VdiName       string
	ImagePathFunc func() string
	VdiUuidKey    string
}

func (*StepFindVdi) Cleanup

func (s *StepFindVdi) Cleanup(state multistep.StateBag)

func (*StepFindVdi) Run

type StepForwardPortOverSSH

type StepForwardPortOverSSH struct {
	RemotePort func(state multistep.StateBag) (uint, error)
	RemoteDest func(state multistep.StateBag) (string, error)

	HostPortMin uint
	HostPortMax uint

	ResultKey string
}

func (*StepForwardPortOverSSH) Cleanup

func (s *StepForwardPortOverSSH) Cleanup(state multistep.StateBag)

func (*StepForwardPortOverSSH) Run

type StepGetConsoleLocation

type StepGetConsoleLocation struct{}

func (*StepGetConsoleLocation) Cleanup

func (s *StepGetConsoleLocation) Cleanup(state multistep.StateBag)

func (*StepGetConsoleLocation) Run

type StepHTTPServer

type StepHTTPServer struct {
	Chan chan<- string
	// contains filtered or unexported fields
}

This step creates and runs the HTTP server that is serving files from the directory specified by the 'http_directory` configuration parameter in the template.

Uses:

config *config
ui     packer.Ui

Produces:

http_port int - The port the HTTP server started on.

func (*StepHTTPServer) Cleanup

func (s *StepHTTPServer) Cleanup(multistep.StateBag)

func (*StepHTTPServer) Run

type StepPrepareOutputDir

type StepPrepareOutputDir struct {
	Force bool
	Path  string
}

func (*StepPrepareOutputDir) Cleanup

func (s *StepPrepareOutputDir) Cleanup(state multistep.StateBag)

func (*StepPrepareOutputDir) Run

type StepShutdown

type StepShutdown struct{}

func (StepShutdown) Cleanup

func (StepShutdown) Cleanup(state multistep.StateBag)

func (StepShutdown) Run

type StepStartOnHIMN

type StepStartOnHIMN struct{}

func (*StepStartOnHIMN) Cleanup

func (s *StepStartOnHIMN) Cleanup(state multistep.StateBag)

func (*StepStartOnHIMN) Run

type StepStartVmPaused

type StepStartVmPaused struct{}

func (*StepStartVmPaused) Cleanup

func (self *StepStartVmPaused) Cleanup(state multistep.StateBag)

func (*StepStartVmPaused) Run

type StepTCPVNCProxy

type StepTCPVNCProxy struct {
	RemoteConsole func(state multistep.StateBag) (string, error)

	HostPortMin uint
	HostPortMax uint
}

func (*StepTCPVNCProxy) Cleanup

func (s *StepTCPVNCProxy) Cleanup(state multistep.StateBag)

func (*StepTCPVNCProxy) Run

type StepTypeBootCommand

type StepTypeBootCommand struct {
	BootCommand []string
	VMName      string
	Ctx         interpolate.Context
}

func (*StepTypeBootCommand) Cleanup

func (*StepTypeBootCommand) Run

type StepUploadVdi

type StepUploadVdi struct {
	VdiNameFunc   func() string
	ImagePathFunc func() string
	VdiUuidKey    string
}

func (*StepUploadVdi) Cleanup

func (s *StepUploadVdi) Cleanup(state multistep.StateBag)

func (*StepUploadVdi) Run

type StepWaitForIP

type StepWaitForIP struct {
	Chan    <-chan string
	Timeout time.Duration
}

func (*StepWaitForIP) Cleanup

func (s *StepWaitForIP) Cleanup(state multistep.StateBag)

func (*StepWaitForIP) Run

type TimeoutError

type TimeoutError struct{}

func (TimeoutError) Error

func (err TimeoutError) Error() string

Jump to

Keyboard shortcuts

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