Class: VagrantPlugins::OpenStack::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::OpenStack::Config
- Defined in:
- lib/vagrant-openstack-plugin/config.rb
Instance Attribute Summary collapse
-
#address_id ⇒ Object
A specific address identifier to use when connecting.
-
#api_key ⇒ String
The API key to access OpenStack.
-
#availability_zone ⇒ Object
Specify the availability zone in which to create the instance.
-
#disks ⇒ Array
The disks to create as OpenStack volumes.
-
#endpoint ⇒ String
The endpoint to access OpenStack.
-
#flavor ⇒ Object
The flavor of server to launch, either the ID or name.
-
#floating_ip ⇒ String
The floating IP address from the IP pool which will be assigned to the instance.
-
#floating_ip_pool ⇒ String
The floating IP pool from which IP addresses can be allocated.
-
#image ⇒ Object
The name or ID of the image to use.
-
#keypair_name ⇒ String
The name of the keypair to use.
-
#metadata ⇒ Hash
A Hash of metadata that will be sent to the instance for configuration.
-
#network ⇒ String
Network configurations for the instance.
- #networks ⇒ Array
-
#orchestration_cfn_template ⇒ Object
Returns the value of attribute orchestration_cfn_template.
-
#orchestration_cfn_template_file ⇒ Object
Returns the value of attribute orchestration_cfn_template_file.
-
#orchestration_cfn_template_parameters ⇒ Object
Returns the value of attribute orchestration_cfn_template_parameters.
-
#orchestration_cfn_template_url ⇒ Object
Returns the value of attribute orchestration_cfn_template_url.
-
#orchestration_stack_destroy ⇒ Object
Returns the value of attribute orchestration_stack_destroy.
-
#orchestration_stack_name ⇒ Object
Heat orchestration configuration parameters.
-
#project_domain ⇒ String
The region to specify when the OpenStack cloud has multiple regions.
-
#project_name ⇒ String
The region to specify when the OpenStack cloud has multiple regions.
-
#proxy ⇒ String
The proxy to specify when making connection to OpenStack API.
-
#region ⇒ String
The region to specify when the OpenStack cloud has multiple regions.
-
#scheduler_hints ⇒ Object
Pass hints to the OpenStack scheduler, e.g.
-
#security_groups ⇒ Array[String]
List of strings representing the security groups to apply.
-
#server_name ⇒ Object
The name of the server.
-
#ssh_ip_family ⇒ String
The IP address family that will be used to connect to the instance.
-
#ssh_username ⇒ String
The SSH username to use with this OpenStack instance.
-
#ssl_verify_peer ⇒ Object
Value for SSL_VERIFY_PEER, defaults to true.
-
#tenant ⇒ String
The tenant to use.
-
#user_data ⇒ String
User data to be sent to the newly created OpenStack instance.
-
#user_domain ⇒ String
The region to specify when the OpenStack cloud has multiple regions.
-
#username ⇒ String
The username to access OpenStack.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 144 def initialize @api_key = UNSET_VALUE @endpoint = UNSET_VALUE @flavor = UNSET_VALUE @image = UNSET_VALUE @server_name = UNSET_VALUE @metatdata = UNSET_VALUE @username = UNSET_VALUE @keypair_name = UNSET_VALUE @network = UNSET_VALUE @networks = UNSET_VALUE @address_id = UNSET_VALUE @scheduler_hints = UNSET_VALUE @availability_zone = UNSET_VALUE @security_groups = UNSET_VALUE @ssh_username = UNSET_VALUE @ssh_ip_family = UNSET_VALUE @tenant = UNSET_VALUE @user_data = UNSET_VALUE @floating_ip = UNSET_VALUE @floating_ip_pool = UNSET_VALUE @region = UNSET_VALUE @project_name = UNSET_VALUE @project_domain = UNSET_VALUE @user_domain = UNSET_VALUE @proxy = UNSET_VALUE @ssl_verify_peer = UNSET_VALUE @disks = UNSET_VALUE @orchestration_stack_name = UNSET_VALUE @orchestration_stack_destroy = UNSET_VALUE @orchestration_cfn_template = UNSET_VALUE @orchestration_cfn_template_file = UNSET_VALUE @orchestration_cfn_template_url = UNSET_VALUE @orchestration_cfn_template_parameters = UNSET_VALUE end |
Instance Attribute Details
#address_id ⇒ Object
A specific address identifier to use when connecting. Overrides ‘network` above if both are set.
51 52 53 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 51 def address_id @address_id end |
#api_key ⇒ String
The API key to access OpenStack.
9 10 11 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 9 def api_key @api_key end |
#availability_zone ⇒ Object
Specify the availability zone in which to create the instance
57 58 59 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 57 def availability_zone @availability_zone end |
#disks ⇒ Array
The disks to create as OpenStack volumes.
130 131 132 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 130 def disks @disks end |
#endpoint ⇒ String
The endpoint to access OpenStack. If nil, it will default to DFW.
15 16 17 |
# File 'lib/vagrant-openstack-plugin/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.
19 20 21 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 19 def flavor @flavor end |
#floating_ip ⇒ String
The floating IP address from the IP pool which will be assigned to the instance.
95 96 97 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 95 def floating_ip @floating_ip end |
#floating_ip_pool ⇒ String
The floating IP pool from which IP addresses can be allocated
100 101 102 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 100 def floating_ip_pool @floating_ip_pool end |
#image ⇒ Object
The name or ID of the image to use. This can also be a regular expression to partially match a name.
23 24 25 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 23 def image @image end |
#keypair_name ⇒ String
The name of the keypair to use.
38 39 40 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 38 def keypair_name @keypair_name end |
#metadata ⇒ Hash
A Hash of metadata that will be sent to the instance for configuration
79 80 81 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 79 def @metadata end |
#network ⇒ String
Network configurations for the instance
43 44 45 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 43 def network @network end |
#networks ⇒ Array
46 47 48 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 46 def networks @networks end |
#orchestration_cfn_template ⇒ Object
Returns the value of attribute orchestration_cfn_template.
139 140 141 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 139 def orchestration_cfn_template @orchestration_cfn_template end |
#orchestration_cfn_template_file ⇒ Object
Returns the value of attribute orchestration_cfn_template_file.
140 141 142 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 140 def orchestration_cfn_template_file @orchestration_cfn_template_file end |
#orchestration_cfn_template_parameters ⇒ Object
Returns the value of attribute orchestration_cfn_template_parameters.
142 143 144 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 142 def orchestration_cfn_template_parameters @orchestration_cfn_template_parameters end |
#orchestration_cfn_template_url ⇒ Object
Returns the value of attribute orchestration_cfn_template_url.
141 142 143 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 141 def orchestration_cfn_template_url @orchestration_cfn_template_url end |
#orchestration_stack_destroy ⇒ Object
Returns the value of attribute orchestration_stack_destroy.
138 139 140 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 138 def orchestration_stack_destroy @orchestration_stack_destroy end |
#orchestration_stack_name ⇒ Object
Heat orchestration configuration parameters.
137 138 139 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 137 def orchestration_stack_name @orchestration_stack_name end |
#project_domain ⇒ String
The region to specify when the OpenStack cloud has multiple regions
115 116 117 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 115 def project_domain @project_domain end |
#project_name ⇒ String
The region to specify when the OpenStack cloud has multiple regions
110 111 112 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 110 def project_name @project_name end |
#proxy ⇒ String
The proxy to specify when making connection to OpenStack API.
125 126 127 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 125 def proxy @proxy end |
#region ⇒ String
The region to specify when the OpenStack cloud has multiple regions
105 106 107 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 105 def region @region end |
#scheduler_hints ⇒ Object
Pass hints to the OpenStack scheduler, e.g. { “cell”: “some cell name” }
54 55 56 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 54 def scheduler_hints @scheduler_hints end |
#security_groups ⇒ Array[String]
List of strings representing the security groups to apply. e.g. [‘ssh’, ‘http’]
63 64 65 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 63 def security_groups @security_groups 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.
28 29 30 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 28 def server_name @server_name end |
#ssh_ip_family ⇒ String
The IP address family that will be used to connect to the instance
74 75 76 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 74 def ssh_ip_family @ssh_ip_family end |
#ssh_username ⇒ String
The SSH username to use with this OpenStack instance. This overrides the ‘config.ssh.username` variable.
69 70 71 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 69 def ssh_username @ssh_username end |
#ssl_verify_peer ⇒ Object
Value for SSL_VERIFY_PEER, defaults to true. Set to false for self signed ssl certificate
134 135 136 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 134 def ssl_verify_peer @ssl_verify_peer end |
#tenant ⇒ String
The tenant to use.
84 85 86 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 84 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.
90 91 92 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 90 def user_data @user_data end |
#user_domain ⇒ String
The region to specify when the OpenStack cloud has multiple regions
120 121 122 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 120 def user_domain @user_domain end |
#username ⇒ String
The username to access OpenStack.
33 34 35 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 33 def username @username end |
Instance Method Details
#finalize! ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 180 def finalize! @api_key = nil if @api_key == UNSET_VALUE @endpoint = nil if @endpoint == UNSET_VALUE @flavor = /m1.tiny/ if @flavor == UNSET_VALUE @image = /cirros/ if @image == UNSET_VALUE @server_name = nil if @server_name == UNSET_VALUE @metadata = nil if @metadata == UNSET_VALUE @username = nil if @username == UNSET_VALUE @network = nil if @network == UNSET_VALUE @networks = nil if @networks == UNSET_VALUE @address_id = 'public' if @address_id == UNSET_VALUE # Keypair defaults to nil @keypair_name = nil if @keypair_name == UNSET_VALUE @scheduler_hints = nil if @scheduler_hints == UNSET_VALUE @availability_zone = nil if @availability_zone == UNSET_VALUE @security_groups = nil if @security_groups == 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 @ssh_ip_family = nil if @ssh_ip_family == UNSET_VALUE @tenant = nil if @tenant == UNSET_VALUE @user_data = "" if @user_data == UNSET_VALUE @floating_ip = nil if @floating_ip == UNSET_VALUE @floating_ip_pool = nil if @floating_ip_pool == UNSET_VALUE @region = nil if @region == UNSET_VALUE @project_name = nil if @project_name == UNSET_VALUE @project_domain = nil if @project_domain == UNSET_VALUE @user_domain = nil if @user_domain == UNSET_VALUE @disks = nil if @disks == UNSET_VALUE @region = nil if @region == UNSET_VALUE @proxy = nil if @proxy == UNSET_VALUE @ssl_verify_peer = nil if @ssl_verify_peer == UNSET_VALUE @orchestration_stack_name = nil if @orchestration_stack_name == UNSET_VALUE @orchestration_stack_destroy = false if @orchestration_stack_destroy == UNSET_VALUE @orchestration_cfn_template = nil if @orchestration_cfn_template == UNSET_VALUE @orchestration_cfn_template_file = nil if @orchestration_cfn_template_file == UNSET_VALUE @orchestration_cfn_template_url = nil if @orchestration_cfn_template_url == UNSET_VALUE @orchestration_cfn_template_parameters = nil if @orchestration_cfn_template_parameters == UNSET_VALUE end |
#validate(machine) ⇒ Object
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/vagrant-openstack-plugin/config.rb', line 228 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 if @disks and @disks.any?{|a| not a.respond_to?("include?")} errors << I18n.t("vagrant_openstack.config.disks.specification_required") elsif @disks errors << I18n.t("vagrant_openstack.config.disks.name_required") if @disks.any?{|a| not a.include?("name")} errors << I18n.t("vagrant_openstack.config.disks.description_required") if @disks.any?{|a| not a.include?("description")} errors << I18n.t("vagrant_openstack.config.disks.size_required") if @disks.any?{|a| not a.include?("size")} end { "OpenStack Provider" => errors } end |