chroot

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2013 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

The chroot package is able to create an Amazon AMI without requiring the launch of a new instance for every build. It does this by attaching and mounting the root volume of another AMI and chrooting into that directory. It then creates an AMI from that attached drive.

Index

Constants

View Source
const BuilderId = "mitchellh.amazon.chroot"

The unique ID for this builder

View Source
const LOCK_EX = 2

See: http://linux.die.net/include/sys/file.h

View Source
const LOCK_NB = 4
View Source
const LOCK_UN = 8

Variables

This section is empty.

Functions

func AvailableDevice

func AvailableDevice() (string, error)

AvailableDevice finds an available device and returns it. Note that you should externally hold a flock or something in order to guarantee that this device is available across processes.

Types

type Builder

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

func (*Builder) Cancel

func (b *Builder) Cancel()

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) error

func (*Builder) Run

func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error)

type Cleanup

type Cleanup interface {
	CleanupFunc(map[string]interface{}) error
}

Cleanup is an interface that some steps implement for early cleanup.

type Communicator

type Communicator struct {
	Chroot string
}

Communicator is a special communicator that works by executing commands locally but within a chroot.

func (*Communicator) Download

func (c *Communicator) Download(src string, w io.Writer) error

func (*Communicator) Start

func (c *Communicator) Start(cmd *packer.RemoteCmd) error

func (*Communicator) Upload

func (c *Communicator) Upload(dst string, r io.Reader) error

type Config

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

	ChrootMounts   [][]string `mapstructure:"chroot_mounts"`
	CopyFiles      []string   `mapstructure:"copy_files"`
	DevicePath     string     `mapstructure:"device_path"`
	MountCommand   string     `mapstructure:"mount_command"`
	MountPath      string     `mapstructure:"mount_path"`
	SourceAmi      string     `mapstructure:"source_ami"`
	UnmountCommand string     `mapstructure:"unmount_command"`
	// contains filtered or unexported fields
}

Config is the configuration that is chained through the steps and settable from the template.

type StepAttachVolume

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

StepAttachVolume attaches the previously created volume to an available device location.

Produces:

device string - The location where the volume was attached.
attach_cleanup CleanupFunc

func (*StepAttachVolume) Cleanup

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

func (*StepAttachVolume) CleanupFunc

func (s *StepAttachVolume) CleanupFunc(state map[string]interface{}) error

func (*StepAttachVolume) Run

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

type StepChrootProvision

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

StepChrootProvision provisions the instance within a chroot.

func (*StepChrootProvision) Cleanup

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

func (*StepChrootProvision) Run

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

type StepCopyFiles

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

StepCopyFiles copies some files from the host into the chroot environment.

Produces:

copy_files_cleanup CleanupFunc - A function to clean up the copied files
early.

func (*StepCopyFiles) Cleanup

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

func (*StepCopyFiles) CleanupFunc

func (s *StepCopyFiles) CleanupFunc(map[string]interface{}) error

func (*StepCopyFiles) Run

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

type StepCreateVolume

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

StepCreateVolume creates a new volume from the snapshot of the root device of the AMI.

Produces:

volume_id string - The ID of the created volume

func (*StepCreateVolume) Cleanup

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

func (*StepCreateVolume) Run

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

type StepEarlyCleanup

type StepEarlyCleanup struct{}

StepEarlyCleanup performs some of the cleanup steps early in order to prepare for snapshotting and creating an AMI.

func (*StepEarlyCleanup) Cleanup

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

func (*StepEarlyCleanup) Run

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

type StepEarlyUnflock

type StepEarlyUnflock struct{}

StepEarlyUnflock unlocks the flock.

func (*StepEarlyUnflock) Cleanup

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

func (*StepEarlyUnflock) Run

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

type StepFlock

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

StepFlock provisions the instance within a chroot.

Produces:

flock_cleanup Cleanup - To perform early cleanup

func (*StepFlock) Cleanup

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

func (*StepFlock) CleanupFunc

func (s *StepFlock) CleanupFunc(state map[string]interface{}) error

func (*StepFlock) Run

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

type StepInstanceInfo

type StepInstanceInfo struct{}

StepInstanceInfo verifies that this builder is running on an EC2 instance.

func (*StepInstanceInfo) Cleanup

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

func (*StepInstanceInfo) Run

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

type StepMountDevice

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

StepMountDevice mounts the attached device.

Produces:

mount_path string - The location where the volume was mounted.
mount_device_cleanup CleanupFunc - To perform early cleanup

func (*StepMountDevice) Cleanup

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

func (*StepMountDevice) CleanupFunc

func (s *StepMountDevice) CleanupFunc(state map[string]interface{}) error

func (*StepMountDevice) Run

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

type StepMountExtra

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

StepMountExtra mounts the attached device.

Produces:

mount_extra_cleanup CleanupFunc - To perform early cleanup

func (*StepMountExtra) Cleanup

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

func (*StepMountExtra) CleanupFunc

func (s *StepMountExtra) CleanupFunc(state map[string]interface{}) error

func (*StepMountExtra) Run

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

type StepPrepareDevice

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

StepPrepareDevice finds an available device and sets it.

func (*StepPrepareDevice) Cleanup

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

func (*StepPrepareDevice) Run

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

type StepRegisterAMI

type StepRegisterAMI struct{}

StepRegisterAMI creates the AMI.

func (*StepRegisterAMI) Cleanup

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

func (*StepRegisterAMI) Run

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

type StepSnapshot

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

StepSnapshot creates a snapshot of the created volume.

Produces:

snapshot_id string - ID of the created snapshot

func (*StepSnapshot) Cleanup

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

func (*StepSnapshot) Run

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

type StepSourceAMIInfo

type StepSourceAMIInfo struct{}

StepSourceAMIInfo extracts critical information from the source AMI that is used throughout the AMI creation process.

Produces:

source_image *ec2.Image - the source AMI info

func (*StepSourceAMIInfo) Cleanup

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

func (*StepSourceAMIInfo) Run

func (s *StepSourceAMIInfo) 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