Class: VagrantPlugins::Skytap::Config
- Defined in:
- lib/vagrant-skytap/config.rb
Instance Attribute Summary collapse
-
#api_token ⇒ String
The secret API token for accessing Skytap.
-
#base_url ⇒ String
The base URL for Skytap API calls.
-
#cpus ⇒ Integer
The total number of virtual CPUs for this VM.
-
#cpuspersocket ⇒ Integer
The number of virtual CPUs per socket.
-
#guestos ⇒ String
The VMware guest OS setting for this machine.
-
#instance_ready_timeout ⇒ Fixnum
The timeout to wait for a VM to become ready.
-
#ram ⇒ Integer
The RAM to use for this machine (measured in MB).
-
#username ⇒ String
The user id for accessing Skytap.
-
#vm_url ⇒ String
The url of the source VM to use.
-
#vpn_url ⇒ String
The url of the VPN to use for connecting to the VM.
Instance Method Summary collapse
-
#finalize! ⇒ Object
——————————————————————- Internal methods.
-
#initialize(region_specific = false) ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize(region_specific = false) ⇒ Config
Returns a new instance of Config.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vagrant-skytap/config.rb', line 56 def initialize(region_specific=false) @username = UNSET_VALUE @api_token = UNSET_VALUE @base_url = UNSET_VALUE @vm_url = UNSET_VALUE @vpn_url = UNSET_VALUE @instance_ready_timeout = UNSET_VALUE @region = UNSET_VALUE @cpus = UNSET_VALUE @cpuspersocket = UNSET_VALUE @ram = UNSET_VALUE @guestos = UNSET_VALUE end |
Instance Attribute Details
#api_token ⇒ String
The secret API token for accessing Skytap.
14 15 16 |
# File 'lib/vagrant-skytap/config.rb', line 14 def api_token @api_token end |
#base_url ⇒ String
The base URL for Skytap API calls.
19 20 21 |
# File 'lib/vagrant-skytap/config.rb', line 19 def base_url @base_url end |
#cpus ⇒ Integer
The total number of virtual CPUs for this VM.
39 40 41 |
# File 'lib/vagrant-skytap/config.rb', line 39 def cpus @cpus end |
#cpuspersocket ⇒ Integer
The number of virtual CPUs per socket.
44 45 46 |
# File 'lib/vagrant-skytap/config.rb', line 44 def cpuspersocket @cpuspersocket end |
#guestos ⇒ String
The VMware guest OS setting for this machine.
54 55 56 |
# File 'lib/vagrant-skytap/config.rb', line 54 def guestos @guestos end |
#instance_ready_timeout ⇒ Fixnum
The timeout to wait for a VM to become ready.
34 35 36 |
# File 'lib/vagrant-skytap/config.rb', line 34 def instance_ready_timeout @instance_ready_timeout end |
#ram ⇒ Integer
The RAM to use for this machine (measured in MB).
49 50 51 |
# File 'lib/vagrant-skytap/config.rb', line 49 def ram @ram end |
#username ⇒ String
The user id for accessing Skytap.
9 10 11 |
# File 'lib/vagrant-skytap/config.rb', line 9 def username @username end |
#vm_url ⇒ String
The url of the source VM to use.
24 25 26 |
# File 'lib/vagrant-skytap/config.rb', line 24 def vm_url @vm_url end |
#vpn_url ⇒ String
The url of the VPN to use for connecting to the VM.
29 30 31 |
# File 'lib/vagrant-skytap/config.rb', line 29 def vpn_url @vpn_url end |
Instance Method Details
#finalize! ⇒ Object
Internal methods.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/vagrant-skytap/config.rb', line 75 def finalize! # Try to get access keys from standard Skytap environment variables; they # will default to nil if the environment variables are not present. @username = ENV['VAGRANT_SKYTAP_USERNAME'] if @username == UNSET_VALUE @api_token = ENV['VAGRANT_SKYTAP_API_TOKEN'] if @api_token == UNSET_VALUE # Base URL for API calls. @base_url = "https://cloud.skytap.com/" if @base_url == UNSET_VALUE # Source VM url must be set. @vm_url = nil if @vm_url == UNSET_VALUE # VPN to use for connection to VM @vpn_url = nil if @vpn_url == UNSET_VALUE # Set the default timeout for waiting for an instance to be ready @instance_ready_timeout = 120 if @instance_ready_timeout == UNSET_VALUE # Hardware settings default to nil (will be obtained # from the source VM) @cpus = nil if @cpus == UNSET_VALUE @cpuspersocket = nil if @cpuspersocket == UNSET_VALUE @ram = nil if @ram == UNSET_VALUE @guestos = nil if @guestos == UNSET_VALUE # Mark that we finalized @__finalized = true end |
#validate(machine) ⇒ Object
104 105 106 107 108 109 110 111 112 |
# File 'lib/vagrant-skytap/config.rb', line 104 def validate(machine) errors = _detected_errors errors << I18n.t('vagrant_skytap.config.username_required') unless username errors << I18n.t('vagrant_skytap.config.api_token_required') unless api_token errors << I18n.t('vagrant_skytap.config.vm_url_required') unless vm_url { "Skytap Provider" => errors } end |