Class: VagrantPlugins::WinAzure::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::WinAzure::Config
- Defined in:
- lib/vagrant-azure/config.rb
Instance Attribute Summary collapse
-
#availability_set_name ⇒ Object
Returns the value of attribute availability_set_name.
-
#cloud_service_name ⇒ Object
Returns the value of attribute cloud_service_name.
-
#deployment_name ⇒ Object
Returns the value of attribute deployment_name.
-
#mgmt_certificate ⇒ Object
Returns the value of attribute mgmt_certificate.
-
#mgmt_endpoint ⇒ Object
Returns the value of attribute mgmt_endpoint.
-
#ssh_certificate_file ⇒ Object
Returns the value of attribute ssh_certificate_file.
-
#ssh_port ⇒ Object
Returns the value of attribute ssh_port.
-
#ssh_private_key_file ⇒ Object
Returns the value of attribute ssh_private_key_file.
-
#state_read_timeout ⇒ Object
Returns the value of attribute state_read_timeout.
-
#storage_access_key ⇒ Object
Returns the value of attribute storage_access_key.
-
#storage_acct_name ⇒ Object
Returns the value of attribute storage_acct_name.
-
#subscription_id ⇒ Object
Returns the value of attribute subscription_id.
-
#tcp_endpoints ⇒ Object
Returns the value of attribute tcp_endpoints.
-
#vm_affinity_group ⇒ Object
Returns the value of attribute vm_affinity_group.
-
#vm_image ⇒ Object
Returns the value of attribute vm_image.
-
#vm_location ⇒ Object
Returns the value of attribute vm_location.
-
#vm_name ⇒ Object
Returns the value of attribute vm_name.
-
#vm_password ⇒ Object
Returns the value of attribute vm_password.
-
#vm_size ⇒ Object
Returns the value of attribute vm_size.
-
#vm_user ⇒ Object
Returns the value of attribute vm_user.
-
#winrm_http_port ⇒ Object
Returns the value of attribute winrm_http_port.
-
#winrm_https_port ⇒ Object
Returns the value of attribute winrm_https_port.
-
#winrm_transport ⇒ Object
Returns the value of attribute winrm_transport.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #merge(other) ⇒ Object
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/vagrant-azure/config.rb', line 38 def initialize @storage_acct_name = UNSET_VALUE @storage_access_key = UNSET_VALUE @mgmt_certificate = UNSET_VALUE @mgmt_endpoint = UNSET_VALUE @subscription_id = UNSET_VALUE @vm_name = UNSET_VALUE @vm_user = UNSET_VALUE @vm_password = UNSET_VALUE @vm_image = UNSET_VALUE @vm_location = UNSET_VALUE @vm_affinity_group = UNSET_VALUE @cloud_service_name = UNSET_VALUE @deployment_name = UNSET_VALUE @tcp_endpoints = UNSET_VALUE @ssh_private_key_file = UNSET_VALUE @ssh_certificate_file = UNSET_VALUE @ssh_port = UNSET_VALUE @vm_size = UNSET_VALUE @winrm_transport = UNSET_VALUE @winrm_http_port = UNSET_VALUE @winrm_https_port = UNSET_VALUE @availability_set_name = UNSET_VALUE @state_read_timeout = UNSET_VALUE end |
Instance Attribute Details
#availability_set_name ⇒ Object
Returns the value of attribute availability_set_name.
34 35 36 |
# File 'lib/vagrant-azure/config.rb', line 34 def availability_set_name @availability_set_name end |
#cloud_service_name ⇒ Object
Returns the value of attribute cloud_service_name.
24 25 26 |
# File 'lib/vagrant-azure/config.rb', line 24 def cloud_service_name @cloud_service_name end |
#deployment_name ⇒ Object
Returns the value of attribute deployment_name.
25 26 27 |
# File 'lib/vagrant-azure/config.rb', line 25 def deployment_name @deployment_name end |
#mgmt_certificate ⇒ Object
Returns the value of attribute mgmt_certificate.
11 12 13 |
# File 'lib/vagrant-azure/config.rb', line 11 def mgmt_certificate @mgmt_certificate end |
#mgmt_endpoint ⇒ Object
Returns the value of attribute mgmt_endpoint.
12 13 14 |
# File 'lib/vagrant-azure/config.rb', line 12 def mgmt_endpoint @mgmt_endpoint end |
#ssh_certificate_file ⇒ Object
Returns the value of attribute ssh_certificate_file.
28 29 30 |
# File 'lib/vagrant-azure/config.rb', line 28 def ssh_certificate_file @ssh_certificate_file end |
#ssh_port ⇒ Object
Returns the value of attribute ssh_port.
29 30 31 |
# File 'lib/vagrant-azure/config.rb', line 29 def ssh_port @ssh_port end |
#ssh_private_key_file ⇒ Object
Returns the value of attribute ssh_private_key_file.
27 28 29 |
# File 'lib/vagrant-azure/config.rb', line 27 def ssh_private_key_file @ssh_private_key_file end |
#state_read_timeout ⇒ Object
Returns the value of attribute state_read_timeout.
36 37 38 |
# File 'lib/vagrant-azure/config.rb', line 36 def state_read_timeout @state_read_timeout end |
#storage_access_key ⇒ Object
Returns the value of attribute storage_access_key.
15 16 17 |
# File 'lib/vagrant-azure/config.rb', line 15 def storage_access_key @storage_access_key end |
#storage_acct_name ⇒ Object
Returns the value of attribute storage_acct_name.
14 15 16 |
# File 'lib/vagrant-azure/config.rb', line 14 def storage_acct_name @storage_acct_name end |
#subscription_id ⇒ Object
Returns the value of attribute subscription_id.
13 14 15 |
# File 'lib/vagrant-azure/config.rb', line 13 def subscription_id @subscription_id end |
#tcp_endpoints ⇒ Object
Returns the value of attribute tcp_endpoints.
26 27 28 |
# File 'lib/vagrant-azure/config.rb', line 26 def tcp_endpoints @tcp_endpoints end |
#vm_affinity_group ⇒ Object
Returns the value of attribute vm_affinity_group.
22 23 24 |
# File 'lib/vagrant-azure/config.rb', line 22 def vm_affinity_group @vm_affinity_group end |
#vm_image ⇒ Object
Returns the value of attribute vm_image.
20 21 22 |
# File 'lib/vagrant-azure/config.rb', line 20 def vm_image @vm_image end |
#vm_location ⇒ Object
Returns the value of attribute vm_location.
21 22 23 |
# File 'lib/vagrant-azure/config.rb', line 21 def vm_location @vm_location end |
#vm_name ⇒ Object
Returns the value of attribute vm_name.
17 18 19 |
# File 'lib/vagrant-azure/config.rb', line 17 def vm_name @vm_name end |
#vm_password ⇒ Object
Returns the value of attribute vm_password.
19 20 21 |
# File 'lib/vagrant-azure/config.rb', line 19 def vm_password @vm_password end |
#vm_size ⇒ Object
Returns the value of attribute vm_size.
30 31 32 |
# File 'lib/vagrant-azure/config.rb', line 30 def vm_size @vm_size end |
#vm_user ⇒ Object
Returns the value of attribute vm_user.
18 19 20 |
# File 'lib/vagrant-azure/config.rb', line 18 def vm_user @vm_user end |
#winrm_http_port ⇒ Object
Returns the value of attribute winrm_http_port.
32 33 34 |
# File 'lib/vagrant-azure/config.rb', line 32 def winrm_http_port @winrm_http_port end |
#winrm_https_port ⇒ Object
Returns the value of attribute winrm_https_port.
33 34 35 |
# File 'lib/vagrant-azure/config.rb', line 33 def winrm_https_port @winrm_https_port end |
#winrm_transport ⇒ Object
Returns the value of attribute winrm_transport.
31 32 33 |
# File 'lib/vagrant-azure/config.rb', line 31 def winrm_transport @winrm_transport end |
Instance Method Details
#finalize! ⇒ Object
66 67 68 69 70 71 72 73 74 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 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/vagrant-azure/config.rb', line 66 def finalize! @storage_acct_name = ENV["AZURE_STORAGE_ACCOUNT"] if \ @storage_acct_name == UNSET_VALUE @storage_access_key = ENV["AZURE_STORAGE_ACCESS_KEY"] if \ @storage_access_key == UNSET_VALUE @mgmt_certificate = ENV["AZURE_MANAGEMENT_CERTIFICATE"] if \ @mgmt_certificate == UNSET_VALUE @mgmt_endpoint = ENV["AZURE_MANAGEMENT_ENDPOINT"] if \ @mgmt_endpoint == UNSET_VALUE @subscription_id = ENV["AZURE_SUBSCRIPTION_ID"] if \ @subscription_id == UNSET_VALUE @vm_name = nil if @vm_name == UNSET_VALUE @vm_user = 'vagrant' if @vm_user == UNSET_VALUE @vm_password = nil if @vm_password == UNSET_VALUE @vm_image = nil if @vm_image == UNSET_VALUE @vm_location = nil if @vm_location == UNSET_VALUE @vm_affinity_group = nil if @vm_affinity_group == UNSET_VALUE @cloud_service_name = nil if @cloud_service_name == UNSET_VALUE @deployment_name = nil if @deployment_name == UNSET_VALUE @tcp_endpoints = nil if @tcp_endpoints == UNSET_VALUE @ssh_private_key_file = nil if @ssh_private_key_file == UNSET_VALUE @ssh_certificate_file = nil if @ssh_certificate_file == UNSET_VALUE @ssh_port = nil if @ssh_port == UNSET_VALUE @vm_size = nil if @vm_size == UNSET_VALUE @winrm_transport = nil if @winrm_transport == UNSET_VALUE @winrm_http_port = nil if @winrm_http_port == UNSET_VALUE @winrm_https_port = nil if @winrm_https_port == UNSET_VALUE @availability_set_name = nil if @availability_set_name == UNSET_VALUE @state_read_timeout = 360 if @state_read_timeout == UNSET_VALUE # This done due to a bug in Ruby SDK - it doesn't generate a storage # account name if add_role = true if @storage_acct_name.nil? || @storage_acct_name.empty? @storage_acct_name = Azure::Core::Utility.random_string( "#{@vm_name}storage" ).gsub(/[^0-9a-z ]/i, '').downcase[0..23] end if @cloud_service_name.nil? || @cloud_service_name.empty? @cloud_service_name = Azure::Core::Utility.random_string( "#{@vm_name}-service-" ) end end |
#merge(other) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/vagrant-azure/config.rb', line 114 def merge(other) super.tap do |result| result.mgmt_certificate = other.mgmt_certificate || \ self.mgmt_certificate result.mgmt_endpoint = other.mgmt_endpoint || \ self.mgmt_endpoint result.subscription_id = other.subscription_id || \ self.subscription_id result.storage_acct_name = other.storage_acct_name || \ self.storage_acct_name result.storage_access_key = other.storage_access_key || \ self.storage_access_key end end |
#validate(machine) ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/vagrant-azure/config.rb', line 129 def validate(machine) errors = _detected_errors # Azure connection properties related validation. errors << "vagrant_azure.subscription_id.required" if \ @subscription_id.nil? errors << "vagrant_azure.mgmt_certificate.required" if \ @mgmt_certificate.nil? errors << "vagrant_azure.mgmt_endpoint.required" if \ @mgmt_endpoint.nil? # Azure Virtual Machine related validation errors << "vagrant_azure.vm_name.required" if @vm_name.nil? { "Windows Azure Provider" => errors } end |