vhd

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2015 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package vhd implements the packer.PostProcessor interface and adds a post-processor that produces a standalone VHD file.

Index

Constants

View Source
const BuilderId = "benwebber.post-processor.vhd"

A unique name for this post-processor.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	// Path is the path to the VHD file on disk.
	Path string
	// Provider represents the upstream source to the
	Provider string
}

Artifact represents a Virtual Hard Disk (VHD) file.

func NewArtifact

func NewArtifact(provider, path string) *Artifact

NewArtifact creates a new VHD artifact.

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

BuilderId returns the unique artifact builder ID.

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

Destroy executes when cleaning up the artifact.

func (*Artifact) Files

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

Files returns a slice of files contained inside the artifact.

func (*Artifact) Id

func (a *Artifact) Id() string

Id returns a unique string representing this particular artifact.

func (*Artifact) State

func (*Artifact) State(name string) interface{}

State represents the state of the VHD artifact and would be used by downstream post-processors.

func (*Artifact) String

func (a *Artifact) String() string

String satisfies the Stringer interface.

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`

	// Where the VHD will be output to.
	OutputPath string `mapstructure:"output"`

	// Whether to keep the Provider artifact (e.g., VirtualBox VMDK).
	KeepInputArtifact bool `mapstructure:"keep_input_artifict"`

	// Whether to overwrite the VHD if it exists.
	Force bool `mapstructure:"force"`
	// contains filtered or unexported fields
}

Config contains the post-processor configuration.

type PostProcessor

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

PostProcessor satisfies the packer.PostProcessor interface.

func (*PostProcessor) Configure

func (p *PostProcessor) Configure(raws ...interface{}) error

Configure the PostProcessor, rendering templated values if necessary.

func (*PostProcessor) PostProcess

func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, error)

PostProcess is the main entry point. It calls a Provider's Convert() method to delegate conversion to that Provider's command-line tool.

type Provider added in v0.2.0

type Provider interface {
	// Name should return a simple lowercase identifier for the provider.
	Name() string

	// Execute runs a command using the Provider's Driver.
	Execute(ui packer.Ui, command ...string) error

	// Convert converts a builder artifact into a VHD located at outputPath.
	Convert(ui packer.Ui, artifact packer.Artifact, outputPath string) error

	// String satisfies the Stringer interface and will be used in log
	// messages.
	String() string
}

A Provider wraps logic necessary to convert specific builder artifacts to VHD.

type QEMUProvider added in v0.2.0

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

QEMUProvider satisfies the Provider interface.

func NewQEMUProvider added in v0.2.1

func NewQEMUProvider() *QEMUProvider

func (*QEMUProvider) Convert added in v0.2.0

func (p *QEMUProvider) Convert(ui packer.Ui, artifact packer.Artifact, outputPath string) error

Convert a QEMU raw/qcow2 artifact to a VHD file.

func (*QEMUProvider) Execute added in v0.2.0

func (p *QEMUProvider) Execute(ui packer.Ui, command ...string) error

Execute wraps qemu-img to run a QEMU command.

func (*QEMUProvider) Name added in v0.2.1

func (p *QEMUProvider) Name() string

func (*QEMUProvider) String added in v0.2.0

func (p *QEMUProvider) String() string

type VirtualBoxProvider added in v0.2.0

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

VirtualBoxProvider satisfies the Provider interface.

func NewVirtualBoxProvider added in v0.2.1

func NewVirtualBoxProvider() *VirtualBoxProvider

func (*VirtualBoxProvider) Convert added in v0.2.0

func (p *VirtualBoxProvider) Convert(ui packer.Ui, artifact packer.Artifact, outputPath string) (err error)

Convert a VirtualBox VMDK artifact to a VHD file.

func (*VirtualBoxProvider) Execute added in v0.2.0

func (p *VirtualBoxProvider) Execute(ui packer.Ui, command ...string) error

Execute wraps VBoxManage to run a VirtualBox command.

func (*VirtualBoxProvider) Name added in v0.2.1

func (p *VirtualBoxProvider) Name() string

func (*VirtualBoxProvider) String added in v0.2.0

func (p *VirtualBoxProvider) String() string

Jump to

Keyboard shortcuts

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