common

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2013 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUnusedConfig added in v0.2.1

func CheckUnusedConfig(md *mapstructure.Metadata) *packer.MultiError

CheckUnusedConfig is a helper that makes sure that the there are no unused configuration keys, properly ignoring keys that don't matter.

func DecodeConfig added in v0.2.1

func DecodeConfig(target interface{}, raws ...interface{}) (*mapstructure.Metadata, error)

DecodeConfig is a helper that handles decoding raw configuration using mapstructure. It returns the metadata and any errors that may happen. If you need extra configuration for mapstructure, you should configure it manually and not use this helper function.

func HashForType added in v0.2.0

func HashForType(t string) hash.Hash

HashForType returns the Hash implementation for the given string type, or nil if the type is not supported.

func MultistepDebugFn

func MultistepDebugFn(ui packer.Ui) multistep.DebugPauseFn

MultistepDebugFn will return a proper multistep.DebugPauseFn to use for debugging if you're using multistep in your builder.

Types

type DownloadClient

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

A DownloadClient helps download, verify checksums, etc.

func NewDownloadClient

func NewDownloadClient(c *DownloadConfig) *DownloadClient

NewDownloadClient returns a new DownloadClient for the given configuration.

func (*DownloadClient) Cancel

func (d *DownloadClient) Cancel()

func (*DownloadClient) Get

func (d *DownloadClient) Get() (string, error)

func (*DownloadClient) PercentProgress

func (d *DownloadClient) PercentProgress() uint

PercentProgress returns the download progress as a percentage.

func (*DownloadClient) VerifyChecksum

func (d *DownloadClient) VerifyChecksum(path string) (bool, error)

VerifyChecksum tests that the path matches the checksum for the download.

type DownloadConfig

type DownloadConfig struct {
	// The source URL in the form of a string.
	Url string

	// This is the path to download the file to.
	TargetPath string

	// DownloaderMap maps a schema to a Download.
	DownloaderMap map[string]Downloader

	// If true, this will copy even a local file to the target
	// location. If false, then it will "download" the file by just
	// returning the local path to the file.
	CopyFile bool

	// The hashing implementation to use to checksum the downloaded file.
	Hash hash.Hash

	// The checksum for the downloaded file. The hash implementation configuration
	// for the downloader will be used to verify with this checksum after
	// it is downloaded.
	Checksum []byte
}

DownloadConfig is the configuration given to instantiate a new download instance. Once a configuration is used to instantiate a download client, it must not be modified.

type Downloader

type Downloader interface {
	Cancel()
	Download(io.Writer, *url.URL) error
	Progress() uint
	Total() uint
}

A downloader is responsible for actually taking a remote URL and downloading it.

type HTTPDownloader

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

HTTPDownloader is an implementation of Downloader that downloads files over HTTP.

func (*HTTPDownloader) Cancel

func (*HTTPDownloader) Cancel()

func (*HTTPDownloader) Download

func (d *HTTPDownloader) Download(dst io.Writer, src *url.URL) error

func (*HTTPDownloader) Progress

func (d *HTTPDownloader) Progress() uint

func (*HTTPDownloader) Total

func (d *HTTPDownloader) Total() uint

type PackerConfig added in v0.2.1

type PackerConfig struct {
	PackerBuildName string `mapstructure:"packer_build_name"`
	PackerDebug     bool   `mapstructure:"packer_debug"`
	PackerForce     bool   `mapstructure:"packer_force"`
}

PackerConfig is a struct that contains the configuration keys that are sent by packer, properly tagged already so mapstructure can load them. Embed this structure into your configuration class to get it.

type StepConnectSSH added in v0.2.0

type StepConnectSSH struct {
	// SSHAddress is a function that returns the TCP address to connect to
	// for SSH. This is a function so that you can query information
	// if necessary for this address.
	SSHAddress func(map[string]interface{}) (string, error)

	// SSHConfig is a function that returns the proper client configuration
	// for SSH access.
	SSHConfig func(map[string]interface{}) (*gossh.ClientConfig, error)

	// SSHWaitTimeout is the total timeout to wait for SSH to become available.
	SSHWaitTimeout time.Duration
	// contains filtered or unexported fields
}

StepConnectSSH is a multistep Step implementation that waits for SSH to become available. It gets the connection information from a single configuration when creating the step.

Uses:

ui packer.Ui

Produces:

communicator packer.Communicator

func (*StepConnectSSH) Cleanup added in v0.2.0

func (s *StepConnectSSH) Cleanup(map[string]interface{})

func (*StepConnectSSH) Run added in v0.2.0

func (s *StepConnectSSH) Run(state map[string]interface{}) multistep.StepAction

type StepCreateFloppy added in v0.2.0

type StepCreateFloppy struct {
	Files []string
	// contains filtered or unexported fields
}

StepCreateFloppy will create a floppy disk with the given files. The floppy disk doesn't support sub-directories. Only files at the root level are supported.

func (*StepCreateFloppy) Cleanup added in v0.2.0

func (s *StepCreateFloppy) Cleanup(map[string]interface{})

func (*StepCreateFloppy) Run added in v0.2.0

func (s *StepCreateFloppy) Run(state map[string]interface{}) multistep.StepAction

type StepProvision added in v0.2.0

type StepProvision struct{}

StepProvision runs the provisioners.

Uses:

communicator packer.Communicator
hook         packer.Hook
ui           packer.Ui

Produces:

<nothing>

func (*StepProvision) Cleanup added in v0.2.0

func (*StepProvision) Cleanup(map[string]interface{})

func (*StepProvision) Run added in v0.2.0

func (*StepProvision) Run(state map[string]interface{}) multistep.StepAction

Jump to

Keyboard shortcuts

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