Documentation ¶
Index ¶
- func ChooseString(vals ...string) string
- func DownloadableURL(original string) (string, error)
- func HashForType(t string) hash.Hash
- func MultistepDebugFn(ui packer.Ui) multistep.DebugPauseFn
- func ScrubConfig(target interface{}, values ...string) string
- type DownloadClient
- type DownloadConfig
- type Downloader
- type HTTPDownloader
- type PackerConfig
- type StepCreateFloppy
- type StepDownload
- type StepProvision
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChooseString ¶ added in v0.6.0
ChooseString returns the first non-empty value.
func DownloadableURL ¶
DownloadableURL processes a URL that may also be a file path and returns a completely valid URL. For example, the original URL might be "local/file.iso" which isn't a valid URL. DownloadableURL will return "file:///local/file.iso"
func HashForType ¶
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.
func ScrubConfig ¶ added in v0.3.10
ScrubConfig is a helper that returns a string representation of any struct with the given values stripped out.
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() int
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 // What to use for the user agent for HTTP requests. If set to "", use the // default user agent provided by Go. UserAgent string }
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(*os.File, *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) Progress ¶
func (d *HTTPDownloader) Progress() uint
func (*HTTPDownloader) Total ¶
func (d *HTTPDownloader) Total() uint
type PackerConfig ¶
type PackerConfig struct { PackerBuildName string `mapstructure:"packer_build_name"` PackerBuilderType string `mapstructure:"packer_builder_type"` PackerDebug bool `mapstructure:"packer_debug"` PackerForce bool `mapstructure:"packer_force"` PackerUserVars map[string]string `mapstructure:"packer_user_variables"` }
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 StepCreateFloppy ¶
type StepCreateFloppy struct { Files []string FilesAdded map[string]bool // 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 ¶
func (s *StepCreateFloppy) Cleanup(multistep.StateBag)
func (*StepCreateFloppy) Run ¶
func (s *StepCreateFloppy) Run(state multistep.StateBag) multistep.StepAction
type StepDownload ¶ added in v0.3.2
type StepDownload struct { // The checksum and the type of the checksum for the download Checksum string ChecksumType string // A short description of the type of download being done. Example: // "ISO" or "Guest Additions" Description string // The name of the key where the final path of the ISO will be put // into the state. ResultKey string // The path where the result should go, otherwise it goes to the // cache directory. TargetPath string // A list of URLs to attempt to download this thing. Url []string // Extension is the extension to force for the file that is downloaded. // Some systems require a certain extension. If this isn't set, the // extension on the URL is used. Otherwise, this will be forced // on the downloaded file for every URL. Extension string }
StepDownload downloads a remote file using the download client within this package. This step handles setting up the download configuration, progress reporting, interrupt handling, etc.
Uses:
cache packer.Cache ui packer.Ui
func (*StepDownload) Cleanup ¶ added in v0.3.2
func (s *StepDownload) Cleanup(multistep.StateBag)
func (*StepDownload) Run ¶ added in v0.3.2
func (s *StepDownload) Run(state multistep.StateBag) multistep.StepAction
type StepProvision ¶
type StepProvision struct {
Comm packer.Communicator
}
StepProvision runs the provisioners.
Uses:
communicator packer.Communicator hook packer.Hook ui packer.Ui
Produces:
<nothing>
func (*StepProvision) Cleanup ¶
func (*StepProvision) Cleanup(multistep.StateBag)
func (*StepProvision) Run ¶
func (s *StepProvision) Run(state multistep.StateBag) multistep.StepAction