openstack

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2016 License: MPL-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "mitchellh.openstack"

The unique ID for this builder

Variables

This section is empty.

Functions

func CommHost added in v0.8.0

func CommHost(
	client *gophercloud.ServiceClient,
	sshinterface string,
	sshipversion string) func(multistep.StateBag) (string, error)

CommHost looks up the host for the communicator.

func SSHConfig

func SSHConfig(username, password string) func(multistep.StateBag) (*ssh.ClientConfig, error)

SSHConfig returns a function that can be used for the SSH communicator config for connecting to the instance created over SSH using a private key or a password.

func WaitForImage

func WaitForImage(client *gophercloud.ServiceClient, imageId string) error

WaitForImage waits for the given Image ID to become ready.

func WaitForState

func WaitForState(conf *StateChangeConf) (i interface{}, err error)

WaitForState watches an object and waits for it to achieve a certain state.

Types

type AccessConfig

type AccessConfig struct {
	Username         string `mapstructure:"username"`
	UserID           string `mapstructure:"user_id"`
	Password         string `mapstructure:"password"`
	IdentityEndpoint string `mapstructure:"identity_endpoint"`
	TenantID         string `mapstructure:"tenant_id"`
	TenantName       string `mapstructure:"tenant_name"`
	DomainID         string `mapstructure:"domain_id"`
	DomainName       string `mapstructure:"domain_name"`
	Insecure         bool   `mapstructure:"insecure"`
	Region           string `mapstructure:"region"`
	EndpointType     string `mapstructure:"endpoint_type"`
	// contains filtered or unexported fields
}

AccessConfig is for common configuration related to openstack access

func (*AccessConfig) Prepare

func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error

type Artifact

type Artifact struct {
	// ImageId of built image
	ImageId string

	// BuilderId is the unique ID for the builder that created this image
	BuilderIdValue string

	// OpenStack connection for performing API stuff.
	Client *gophercloud.ServiceClient
}

Artifact is an artifact implementation that contains built images.

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (*Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State added in v0.7.2

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

func (*Artifact) String

func (a *Artifact) String() string

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{}) ([]string, error)

func (*Builder) Run

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

type Config added in v0.8.0

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

	AccessConfig `mapstructure:",squash"`
	ImageConfig  `mapstructure:",squash"`
	RunConfig    `mapstructure:",squash"`
	// contains filtered or unexported fields
}

type ImageConfig

type ImageConfig struct {
	ImageName       string                       `mapstructure:"image_name"`
	ImageMetadata   map[string]string            `mapstructure:"metadata"`
	ImageVisibility imageservice.ImageVisibility `mapstructure:"image_visibility"`
	ImageMembers    []string                     `mapstructure:"image_members"`
}

ImageConfig is for common configuration related to creating Images.

func (*ImageConfig) Prepare

func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error

type RunConfig

type RunConfig struct {
	Comm           communicator.Config `mapstructure:",squash"`
	SSHKeyPairName string              `mapstructure:"ssh_keypair_name"`
	SSHInterface   string              `mapstructure:"ssh_interface"`
	SSHIPVersion   string              `mapstructure:"ssh_ip_version"`

	SourceImage      string   `mapstructure:"source_image"`
	SourceImageName  string   `mapstructure:"source_image_name"`
	Flavor           string   `mapstructure:"flavor"`
	AvailabilityZone string   `mapstructure:"availability_zone"`
	RackconnectWait  bool     `mapstructure:"rackconnect_wait"`
	FloatingIpPool   string   `mapstructure:"floating_ip_pool"`
	FloatingIp       string   `mapstructure:"floating_ip"`
	SecurityGroups   []string `mapstructure:"security_groups"`
	Networks         []string `mapstructure:"networks"`
	UserData         string   `mapstructure:"user_data"`
	UserDataFile     string   `mapstructure:"user_data_file"`

	ConfigDrive bool `mapstructure:"config_drive"`

	// Not really used, but here for BC
	OpenstackProvider string `mapstructure:"openstack_provider"`
	UseFloatingIp     bool   `mapstructure:"use_floating_ip"`
}

RunConfig contains configuration for running an instance from a source image and details on how to access that launched image.

func (*RunConfig) Prepare

func (c *RunConfig) Prepare(ctx *interpolate.Context) []error

type StateChangeConf

type StateChangeConf struct {
	Pending   []string
	Refresh   StateRefreshFunc
	StepState multistep.StateBag
	Target    []string
}

StateChangeConf is the configuration struct used for `WaitForState`.

type StateRefreshFunc

type StateRefreshFunc func() (result interface{}, state string, progress int, err error)

StateRefreshFunc is a function type used for StateChangeConf that is responsible for refreshing the item being watched for a state change.

It returns three results. `result` is any object that will be returned as the final object after waiting for state change. This allows you to return the final updated object, for example an openstack instance after refreshing it.

`state` is the latest state of that object. And `err` is any error that may have happened while refreshing the state.

func ServerStateRefreshFunc

func ServerStateRefreshFunc(
	client *gophercloud.ServiceClient, s *servers.Server) StateRefreshFunc

ServerStateRefreshFunc returns a StateRefreshFunc that is used to watch an openstack server.

type StepAllocateIp added in v0.6.0

type StepAllocateIp struct {
	FloatingIpPool string
	FloatingIp     string
}

func (*StepAllocateIp) Cleanup added in v0.6.0

func (s *StepAllocateIp) Cleanup(state multistep.StateBag)

func (*StepAllocateIp) Run added in v0.6.0

type StepGetPassword added in v0.10.0

type StepGetPassword struct {
	Debug bool
	Comm  *communicator.Config
}

StepGetPassword reads the password from a booted OpenStack server and sets it on the WinRM config.

func (*StepGetPassword) Cleanup added in v0.10.0

func (s *StepGetPassword) Cleanup(multistep.StateBag)

func (*StepGetPassword) Run added in v0.10.0

type StepKeyPair

type StepKeyPair struct {
	Debug          bool
	DebugKeyPath   string
	KeyPairName    string
	PrivateKeyFile string
	// contains filtered or unexported fields
}

func (*StepKeyPair) Cleanup

func (s *StepKeyPair) Cleanup(state multistep.StateBag)

func (*StepKeyPair) Run

type StepLoadExtensions added in v0.8.0

type StepLoadExtensions struct{}

StepLoadExtensions gets the FlavorRef from a Flavor. It first assumes that the Flavor is a ref and verifies it. Otherwise, it tries to find the flavor by name.

func (*StepLoadExtensions) Cleanup added in v0.8.0

func (s *StepLoadExtensions) Cleanup(state multistep.StateBag)

func (*StepLoadExtensions) Run added in v0.8.0

type StepLoadFlavor added in v0.8.0

type StepLoadFlavor struct {
	Flavor string
}

StepLoadFlavor gets the FlavorRef from a Flavor. It first assumes that the Flavor is a ref and verifies it. Otherwise, it tries to find the flavor by name.

func (*StepLoadFlavor) Cleanup added in v0.8.0

func (s *StepLoadFlavor) Cleanup(state multistep.StateBag)

func (*StepLoadFlavor) Run added in v0.8.0

type StepRunSourceServer

type StepRunSourceServer struct {
	Name             string
	SourceImage      string
	SourceImageName  string
	SecurityGroups   []string
	Networks         []string
	AvailabilityZone string
	UserData         string
	UserDataFile     string
	ConfigDrive      bool
	// contains filtered or unexported fields
}

func (*StepRunSourceServer) Cleanup

func (s *StepRunSourceServer) Cleanup(state multistep.StateBag)

func (*StepRunSourceServer) Run

type StepStopServer added in v0.8.0

type StepStopServer struct{}

func (*StepStopServer) Cleanup added in v0.8.0

func (s *StepStopServer) Cleanup(state multistep.StateBag)

func (*StepStopServer) Run added in v0.8.0

type StepWaitForRackConnect added in v0.8.0

type StepWaitForRackConnect struct {
	Wait bool
}

func (*StepWaitForRackConnect) Cleanup added in v0.8.0

func (s *StepWaitForRackConnect) Cleanup(state multistep.StateBag)

func (*StepWaitForRackConnect) Run added in v0.8.0

Jump to

Keyboard shortcuts

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