class VagrantPlugins::OpenStack::Config

Attributes

api_key[RW]

@return [String]

endpoint[RW]

The endpoint to access OpenStack.

@return [String]

flavor[RW]

The flavor of server to launch, either the ID or name. This can also be a regular expression to partially match a name.

image[RW]

The name or ID of the image to use. This can also be a regular expression to partially match a name.

keypair_name[RW]

The name of the keypair to use.

@return [String]

metadata[RW]

Metadata to be sent to the newly created OpenStack instance.

@return [Hash]

networks[RW]

@return [String]

public_network_name[RW]

@return [String]

region[RW]

Openstack region, if your openstack instance uses these. Rackspace typically uses these. You need to provide their three letter acronym (for example: DFW) @return [String]

scheduler_hints[RW]

@return [Hash]

server_name[RW]

The name of the server. This defaults to the name of the machine defined by Vagrant (via ‘config.vm.define`), but can be overriden here.

ssh_username[RW]

The SSH username to use with this OpenStack instance. This overrides the ‘config.ssh.username` variable.

@return [String]

tenant[RW]

@return [String]

user_data[RW]

User data to be sent to the newly created OpenStack instance. Use this e.g. to inject a script at boot time.

@return [String]

username[RW]

The username to access OpenStack.

@return [String]

Public Class Methods

new() click to toggle source
# File lib/vagrant-openstack/config.rb, line 73
def initialize
  @api_key  = UNSET_VALUE
  @endpoint = UNSET_VALUE
  @region = UNSET_VALUE
  @flavor   = UNSET_VALUE
  @image    = UNSET_VALUE
  @server_name = UNSET_VALUE
  @username = UNSET_VALUE
  @keypair_name = UNSET_VALUE
  @ssh_username = UNSET_VALUE
  @user_data = UNSET_VALUE
  @metadata = UNSET_VALUE
  @public_network_name = UNSET_VALUE
  @networks = UNSET_VALUE
  @tenant = UNSET_VALUE
  @scheduler_hints = UNSET_VALUE
end

Public Instance Methods

finalize!() click to toggle source
# File lib/vagrant-openstack/config.rb, line 91
def finalize!
  @api_key  = nil if @api_key == UNSET_VALUE
  @endpoint = nil if @endpoint == UNSET_VALUE
  @region = nil if @region == UNSET_VALUE
  @flavor   = /m1.tiny/ if @flavor == UNSET_VALUE
  @image    = /cirros/ if @image == UNSET_VALUE
  @server_name = nil if @server_name == UNSET_VALUE
  @username = nil if @username == UNSET_VALUE

  # Keypair defaults to nil
  @keypair_name = nil if @keypair_name == UNSET_VALUE

  # The SSH values by default are nil, and the top-level config
  # `config.ssh` values are used.
  @ssh_username = nil if @ssh_username == UNSET_VALUE

  @user_data = "" if @user_data == UNSET_VALUE
  @metadata = {} if @metadata == UNSET_VALUE

  @public_network_name = "public" if @public_network_name == UNSET_VALUE
  @networks = [@public_network_name] if @networks == UNSET_VALUE
  @tenant = nil if @tenant == UNSET_VALUE
  @scheduler_hints = {} if @scheduler_hints == UNSET_VALUE
end
validate(machine) click to toggle source
# File lib/vagrant-openstack/config.rb, line 116
def validate(machine)
  errors = []

  errors << I18n.t("vagrant_openstack.config.api_key_required") if !@api_key
  errors << I18n.t("vagrant_openstack.config.username_required") if !@username

  { "OpenStack Provider" => errors }
end