Class: VagrantPlugins::OpenStack::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::OpenStack::Config
- Defined in:
- lib/vagrant-openstack-cloud-provider/config.rb
Instance Attribute Summary collapse
-
#api_key ⇒ String
The API key to access OpenStack.
-
#endpoint ⇒ String
The endpoint to access OpenStack.
-
#flavor ⇒ Object
The flavor of server to launch, either the ID or name.
-
#image ⇒ Object
The name or ID of the image to use.
-
#keypair_name ⇒ String
The name of the keypair to use.
-
#metadata ⇒ Hash
Metadata to be sent to the newly created OpenStack instance.
- #networks ⇒ String
- #public_network_name ⇒ String
-
#region ⇒ String
Openstack region, if your openstack instance uses these.
- #report_progress ⇒ Bool
- #scheduler_hints ⇒ Hash
-
#server_name ⇒ Object
The name of the server.
-
#ssh_username ⇒ String
The SSH username to use with this OpenStack instance.
- #tenant ⇒ String
-
#user_data ⇒ String
User data to be sent to the newly created OpenStack instance.
-
#username ⇒ String
The username to access OpenStack.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
alias_method :report_progress?, :report_progress.
- #instance_build_status_check_interval ⇒ Integer
- #instance_build_timeout ⇒ Integer
- #instance_ssh_check_interval ⇒ Integer
- #instance_ssh_timeout ⇒ Integer
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
alias_method :report_progress?, :report_progress
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 90 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 = UNSET_VALUE @public_network_name = UNSET_VALUE @networks = UNSET_VALUE @tenant = UNSET_VALUE @scheduler_hints = UNSET_VALUE @instance_build_timeout = UNSET_VALUE @instance_build_status_check_interval = UNSET_VALUE @instance_ssh_timeout = UNSET_VALUE @instance_ssh_check_interval = UNSET_VALUE @report_progress = UNSET_VALUE end |
Instance Attribute Details
#api_key ⇒ String
The API key to access OpenStack.
10 11 12 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 10 def api_key @api_key end |
#endpoint ⇒ String
The endpoint to access OpenStack.
15 16 17 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 15 def endpoint @endpoint end |
#flavor ⇒ Object
The flavor of server to launch, either the ID or name. This can also be a regular expression to partially match a name.
24 25 26 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 24 def flavor @flavor end |
#image ⇒ Object
The name or ID of the image to use. This can also be a regular expression to partially match a name.
28 29 30 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 28 def image @image end |
#keypair_name ⇒ String
The name of the keypair to use.
43 44 45 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 43 def keypair_name @keypair_name end |
#metadata ⇒ Hash
Metadata to be sent to the newly created OpenStack instance.
60 61 62 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 60 def end |
#networks ⇒ String
66 67 68 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 66 def networks @networks end |
#public_network_name ⇒ String
63 64 65 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 63 def public_network_name @public_network_name end |
#region ⇒ String
Openstack region, if your openstack instance uses these. Rackspace typically uses these. You need to provide their three letter acronym (for example: DFW)
20 21 22 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 20 def region @region end |
#report_progress ⇒ Bool
87 88 89 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 87 def report_progress @report_progress end |
#scheduler_hints ⇒ Hash
72 73 74 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 72 def scheduler_hints @scheduler_hints end |
#server_name ⇒ Object
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.
33 34 35 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 33 def server_name @server_name end |
#ssh_username ⇒ String
The SSH username to use with this OpenStack instance. This overrides the ‘config.ssh.username` variable.
49 50 51 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 49 def ssh_username @ssh_username end |
#tenant ⇒ String
69 70 71 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 69 def tenant @tenant end |
#user_data ⇒ String
User data to be sent to the newly created OpenStack instance. Use this e.g. to inject a script at boot time.
55 56 57 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 55 def user_data @user_data end |
#username ⇒ String
The username to access OpenStack.
38 39 40 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 38 def username @username end |
Instance Method Details
#finalize! ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 113 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 = {} if == 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 @instance_build_timeout = 120 if @instance_build_timeout == UNSET_VALUE @instance_build_status_check_interval = 1 if @instance_build_status_check_interval == UNSET_VALUE @instance_ssh_timeout = 60 if @instance_ssh_timeout == UNSET_VALUE @instance_ssh_check_interval = 2 if @instance_ssh_check_interval == UNSET_VALUE @report_progress = true if @report_progress == UNSET_VALUE end |
#instance_build_status_check_interval ⇒ Integer
78 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 78 casting_attr_accessor :instance_build_status_check_interval, Integer, greater_than(0) |
#instance_build_timeout ⇒ Integer
75 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 75 casting_attr_accessor :instance_build_timeout, Integer, greater_than(0) |
#instance_ssh_check_interval ⇒ Integer
84 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 84 casting_attr_accessor :instance_ssh_check_interval, Integer, greater_than(0) |
#instance_ssh_timeout ⇒ Integer
81 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 81 casting_attr_accessor :instance_ssh_timeout, Integer, greater_than(0) |
#validate(machine) ⇒ Object
144 145 146 147 148 149 150 151 |
# File 'lib/vagrant-openstack-cloud-provider/config.rb', line 144 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 |