common

package
v0.0.0-...-5f27263 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2016 License: MPL-2.0 Imports: 28 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 ExecuteHostSSHCmds

func ExecuteHostSSHCmds(state multistep.StateBag, cmds []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 FindResidentHost

func FindResidentHost(state multistep.StateBag, instance *xsclient.VM, uuid string) (err error)

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

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

func NewArtifact

func NewArtifact(dir string, state map[string]interface{}, files []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)

func UploadFile

func UploadFile(state multistep.StateBag, localFilename string, remoteFilename string, allowExecute bool) 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) GetSrByName

func (config CommonConfig) GetSrByName(client xsclient.XenAPIClient, SrName string) (*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 (self *StepAttachVdi) Cleanup(state multistep.StateBag)

func (*StepAttachVdi) Run

type StepBootWait

type StepBootWait struct{}

func (*StepBootWait) Cleanup

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

func (*StepBootWait) Run

type StepDetachVdi

type StepDetachVdi struct {
	VdiUuidKey string
}

func (*StepDetachVdi) Cleanup

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

func (*StepDetachVdi) Run

type StepExport

type StepExport struct {
	OutputFormat string
}

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 (self *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 (self *StepForwardPortOverSSH) Cleanup(state multistep.StateBag)

func (*StepForwardPortOverSSH) Run

type StepGetVNCPort

type StepGetVNCPort struct{}

func (*StepGetVNCPort) Cleanup

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

func (*StepGetVNCPort) 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 StepIsoDownload

type StepIsoDownload struct {
	IsoName   string
	SrName    string
	DlUrl     string
	ScriptUrl string
}

func (StepIsoDownload) Cleanup

func (StepIsoDownload) Cleanup(state multistep.StateBag)

func (*StepIsoDownload) Run

type StepPrepareNfsExport

type StepPrepareNfsExport struct {
	NfsMount string
}

func (StepPrepareNfsExport) Cleanup

func (StepPrepareNfsExport) Cleanup(state multistep.StateBag)

func (*StepPrepareNfsExport) Run

type StepPrepareOutputDir

type StepPrepareOutputDir struct {
	Force bool
	Path  string
}

func (*StepPrepareOutputDir) Cleanup

func (self *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 {
	PingTest bool
}

func (*StepStartOnHIMN) Cleanup

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

func (*StepStartOnHIMN) Run

type StepStartVm

type StepStartVm struct{}

func (*StepStartVm) Cleanup

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

func (*StepStartVm) Run

type StepStartVmPaused

type StepStartVmPaused struct{}

func (*StepStartVmPaused) Cleanup

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

func (*StepStartVmPaused) Run

type StepTypeBootCommand

type StepTypeBootCommand struct {
	Ctx interpolate.Context
}

func (*StepTypeBootCommand) Cleanup

func (self *StepTypeBootCommand) Cleanup(multistep.StateBag)

func (*StepTypeBootCommand) Run

type StepUploadVdi

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

func (*StepUploadVdi) Cleanup

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

func (*StepUploadVdi) Run

type StepWaitForIP

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

func (*StepWaitForIP) Cleanup

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

func (*StepWaitForIP) Run

type StepWaitForShutdown

type StepWaitForShutdown struct{}

func (StepWaitForShutdown) Cleanup

func (StepWaitForShutdown) Cleanup(state multistep.StateBag)

func (StepWaitForShutdown) 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