kitchen-azurerm 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d41d3dc84115d01efb811a9b47efadad76b3dbf
4
- data.tar.gz: 0caf860272a7d70f7356889b2b1b013123541a53
3
+ metadata.gz: 5913806cea6adac232bb78ca36c28a3c5d5d8543
4
+ data.tar.gz: c6299ff17af05d0998a91ff49aacc8c46593e394
5
5
  SHA512:
6
- metadata.gz: 48b2098a84cf1a4c68e6289578cfa94c2d9e7fc769ce7ff77691d0df6f86a4f642594497be6569a120afa3107ad747cef38a4ad8b808c9ddc70ad63065e485e1
7
- data.tar.gz: 536e2e842cee0d13ec3b06819256608bb0f0c879e9417ce0ca66a6ed66b771061dcc8ad808facd85fc20210288eb6da866ba7ed1f0c6fe04a89c1b8866404870
6
+ metadata.gz: b2c2d28c4ef6d699aaf1f73d2f46c84314120feea1a21aee9d85b3315a3bb8f401a119302f21ec24585b96c0b602281240dd1637376c12b1b61b55eac3ab8cf0
7
+ data.tar.gz: 3cdea0e98ab8f30f6dc34b749e8697130a00074d4c84ff283007cfa1de3c10a6ce2ef9e55d926678a460d07f5a16f377ed1a4612bf8e45a5e17cfe070351b5ac
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # kitchen-azurerm Changelog
2
2
 
3
+ ## [0.6.0] - 2016-08-22
4
+ - Supports latest autogenerated resources from Azure SDK for Ruby (0.5.0) (@stuartpreston)
5
+ - Removes unnecessary direct depdendencies on older ms_rest libraries (@stuartpreston)
6
+ - ssh_key will be used in preference to password if both are supplied (@stuartpreston)
7
+
3
8
  ## [0.5.0] - 2016-08-07
4
9
  - Adding support for internal (e.g. ExpressRoute/VPN) access to created VM (@stuartpreston)
5
10
 
data/README.md CHANGED
@@ -48,7 +48,7 @@ Note that the environment variables, if set, take preference over the values in
48
48
 
49
49
  ### .kitchen.yml example 1 - Linux/Ubuntu
50
50
 
51
- Here's an example ```.kitchen.yml``` file that provisions an Ubuntu Server, using Chef Zero as the provisioner and SSH as the transport. Note that if the key does not exist at the specified location, it will be created.
51
+ Here's an example ```.kitchen.yml``` file that provisions an Ubuntu Server, using Chef Zero as the provisioner and SSH as the transport. Note that if the key does not exist at the specified location, it will be created. Also note that if ```ssh_key``` is supplied, Test Kitchen will use this in preference to any default/configured passwords that are supplied.
52
52
 
53
53
  ```yaml
54
54
  ---
@@ -77,7 +77,7 @@ module Kitchen
77
77
  bootDiagnosticsEnabled: config[:boot_diagnostics_enabled],
78
78
  newStorageAccountName: "storage#{state[:uuid]}",
79
79
  adminUsername: state[:username],
80
- adminPassword: state[:password],
80
+ adminPassword: state[:password] || 'P2ssw0rd',
81
81
  dnsNameForPublicIP: "kitchen-#{state[:uuid]}",
82
82
  imagePublisher: image_publisher,
83
83
  imageOffer: image_offer,
@@ -95,15 +95,10 @@ module Kitchen
95
95
  resource_group.location = config[:location]
96
96
  begin
97
97
  info "Creating Resource Group: #{state[:azure_resource_group_name]}"
98
- resource_management_client.resource_groups.create_or_update(state[:azure_resource_group_name], resource_group).value!
98
+ resource_management_client.resource_groups.create_or_update(state[:azure_resource_group_name], resource_group)
99
99
  rescue ::MsRestAzure::AzureOperationError => operation_error
100
- error_message = if operation_error.body.nil? == true
101
- operation_error.inspect
102
- else
103
- operation_error.body['error']
104
- end
105
- info error_message
106
- raise error_message
100
+ error operation_error.body
101
+ raise operation_error
107
102
  end
108
103
 
109
104
  # Execute deployment steps
@@ -111,12 +106,12 @@ module Kitchen
111
106
  if File.file?(config[:pre_deployment_template])
112
107
  pre_deployment_name = "pre-deploy-#{state[:uuid]}"
113
108
  info "Creating deployment: #{pre_deployment_name}"
114
- resource_management_client.deployments.create_or_update(state[:azure_resource_group_name], pre_deployment_name, pre_deployment(config[:pre_deployment_template], config[:pre_deployment_parameters])).value!
109
+ resource_management_client.deployments.begin_create_or_update_async(state[:azure_resource_group_name], pre_deployment_name, pre_deployment(config[:pre_deployment_template], config[:pre_deployment_parameters])).value!
115
110
  follow_deployment_until_end_state(state[:azure_resource_group_name], pre_deployment_name)
116
111
  end
117
112
  deployment_name = "deploy-#{state[:uuid]}"
118
113
  info "Creating deployment: #{deployment_name}"
119
- resource_management_client.deployments.create_or_update(state[:azure_resource_group_name], deployment_name, deployment(deployment_parameters)).value!
114
+ resource_management_client.deployments.begin_create_or_update_async(state[:azure_resource_group_name], deployment_name, deployment(deployment_parameters)).value!
120
115
  rescue ::MsRestAzure::AzureOperationError => operation_error
121
116
  rest_error = operation_error.body['error']
122
117
  deployment_active = rest_error['code'] == 'DeploymentActive'
@@ -134,19 +129,19 @@ module Kitchen
134
129
 
135
130
  if config[:vnet_id] == ''
136
131
  # Retrieve the public IP from the resource group:
137
- network_management_client = ::Azure::ARM::Network::NetworkResourceProviderClient.new(credentials)
132
+ network_management_client = ::Azure::ARM::Network::NetworkManagementClient.new(credentials)
138
133
  network_management_client.subscription_id = config[:subscription_id]
139
- result = network_management_client.public_ip_addresses.get(state[:azure_resource_group_name], 'publicip').value!
140
- info "IP Address is: #{result.body.properties.ip_address} [#{result.body.properties.dns_settings.fqdn}]"
141
- state[:hostname] = result.body.properties.ip_address
134
+ result = network_management_client.public_ipaddresses.get(state[:azure_resource_group_name], 'publicip')
135
+ info "IP Address is: #{result.ip_address} [#{result.dns_settings.fqdn}]"
136
+ state[:hostname] = result.ip_address
142
137
  else
143
138
  # Retrieve the internal IP from the resource group:
144
- network_management_client = ::Azure::ARM::Network::NetworkResourceProviderClient.new(credentials)
139
+ network_management_client = ::Azure::ARM::Network::NetworkManagementClient.new(credentials)
145
140
  network_management_client.subscription_id = config[:subscription_id]
146
141
  network_interfaces = ::Azure::ARM::Network::NetworkInterfaces.new(network_management_client)
147
- result = network_interfaces.get(state[:azure_resource_group_name], 'nic').value!
148
- info "IP Address is: #{result.body.properties.ip_configurations[0].properties.private_ipaddress}"
149
- state[:hostname] = result.body.properties.ip_configurations[0].properties.private_ipaddress
142
+ result = network_interfaces.get(state[:azure_resource_group_name], 'nic')
143
+ info "IP Address is: #{result.ip_configurations[0].private_ipaddress}"
144
+ state[:hostname] = result.ip_configurations[0].private_ipaddress
150
145
  end
151
146
  end
152
147
 
@@ -161,7 +156,7 @@ module Kitchen
161
156
  [:subscription_id, :username, :password, :vm_name, :azure_management_url].each do |config_element|
162
157
  state[config_element] = config[config_element] unless existing_state_value?(state, config_element)
163
158
  end
164
-
159
+ state.delete(:password) unless instance.transport[:ssh_key].nil?
165
160
  state
166
161
  end
167
162
 
@@ -172,7 +167,7 @@ module Kitchen
172
167
 
173
168
  def template_for_transport_name
174
169
  template = JSON.parse(virtual_machine_deployment_template)
175
- if instance.transport.name.casecmp('winrm') == 0
170
+ if instance.transport.name.casecmp('winrm').zero?
176
171
  encoded_command = Base64.strict_encode64(enable_winrm_powershell_script)
177
172
  command = command_to_execute
178
173
  template['resources'].select { |h| h['type'] == 'Microsoft.Compute/virtualMachines' }.each do |resource|
@@ -257,8 +252,8 @@ module Kitchen
257
252
  end
258
253
 
259
254
  def show_failed_operations(resource_group, deployment_name)
260
- failed_operations = resource_management_client.deployment_operations.list(resource_group, deployment_name).value!
261
- failed_operations.body.value.each do |val|
255
+ failed_operations = resource_management_client.deployment_operations.list(resource_group, deployment_name)
256
+ failed_operations.each do |val|
262
257
  resource_code = val.properties.status_code
263
258
  raise val.properties.status_message.inspect.to_s if resource_code != 'OK'
264
259
  end
@@ -266,9 +261,10 @@ module Kitchen
266
261
 
267
262
  def list_outstanding_deployment_operations(resource_group, deployment_name)
268
263
  end_operation_states = 'Failed,Succeeded'
269
- deployment_operations = resource_management_client.deployment_operations.list(resource_group, deployment_name).value!
270
- deployment_operations.body.value.each do |val|
264
+ deployment_operations = resource_management_client.deployment_operations.list(resource_group, deployment_name)
265
+ deployment_operations.each do |val|
271
266
  resource_provisioning_state = val.properties.provisioning_state
267
+
272
268
  resource_name = val.properties.target_resource.resource_name
273
269
  resource_type = val.properties.target_resource.resource_type
274
270
  end_operation_state_reached = end_operation_states.split(',').include?(resource_provisioning_state)
@@ -279,8 +275,8 @@ module Kitchen
279
275
  end
280
276
 
281
277
  def deployment_state(resource_group, deployment_name)
282
- deployments = resource_management_client.deployments.get(resource_group, deployment_name).value!
283
- deployments.body.properties.provisioning_state
278
+ deployments = resource_management_client.deployments.get(resource_group, deployment_name)
279
+ deployments.properties.provisioning_state
284
280
  end
285
281
 
286
282
  def destroy(state)
@@ -290,10 +286,10 @@ module Kitchen
290
286
  resource_management_client.subscription_id = state[:subscription_id]
291
287
  begin
292
288
  info "Destroying Resource Group: #{state[:azure_resource_group_name]}"
293
- resource_management_client.resource_groups.begin_delete(state[:azure_resource_group_name]).value!
289
+ resource_management_client.resource_groups.begin_delete(state[:azure_resource_group_name])
294
290
  info 'Destroy operation accepted and will continue in the background.'
295
291
  rescue ::MsRestAzure::AzureOperationError => operation_error
296
- info operation_error.body['error']
292
+ error operation_error.body
297
293
  raise operation_error
298
294
  end
299
295
  state.delete(:server_id)
metadata CHANGED
@@ -1,19 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-azurerm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Preston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-07 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 3.0.0
@@ -21,6 +24,9 @@ dependencies:
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 3.0.0
@@ -28,58 +34,42 @@ dependencies:
28
34
  name: azure_mgmt_resources
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - '='
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 0.1.1
39
+ version: '0.5'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.5.0
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - '='
47
+ - - "~>"
39
48
  - !ruby/object:Gem::Version
40
- version: 0.1.1
49
+ version: '0.5'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.5.0
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: azure_mgmt_network
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 0.1.1
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
57
+ - - "~>"
53
58
  - !ruby/object:Gem::Version
54
- version: 0.1.1
55
- - !ruby/object:Gem::Dependency
56
- name: ms_rest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
59
+ version: '0.5'
60
+ - - ">="
60
61
  - !ruby/object:Gem::Version
61
- version: 0.1.2
62
+ version: 0.5.0
62
63
  type: :runtime
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: 0.1.2
69
- - !ruby/object:Gem::Dependency
70
- name: ms_rest_azure
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
67
+ - - "~>"
74
68
  - !ruby/object:Gem::Version
75
- version: 0.1.2
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
69
+ version: '0.5'
70
+ - - ">="
81
71
  - !ruby/object:Gem::Version
82
- version: 0.1.2
72
+ version: 0.5.0
83
73
  - !ruby/object:Gem::Dependency
84
74
  name: sshkey
85
75
  requirement: !ruby/object:Gem::Requirement
@@ -87,6 +77,9 @@ dependencies:
87
77
  - - "~>"
88
78
  - !ruby/object:Gem::Version
89
79
  version: '1'
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.0.0
90
83
  type: :runtime
91
84
  prerelease: false
92
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -94,20 +87,9 @@ dependencies:
94
87
  - - "~>"
95
88
  - !ruby/object:Gem::Version
96
89
  version: '1'
97
- - !ruby/object:Gem::Dependency
98
- name: concurrent-ruby
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 1.0.2
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
90
+ - - ">="
109
91
  - !ruby/object:Gem::Version
110
- version: 1.0.2
92
+ version: 1.0.0
111
93
  - !ruby/object:Gem::Dependency
112
94
  name: bundler
113
95
  requirement: !ruby/object:Gem::Requirement
@@ -201,4 +183,3 @@ signing_key:
201
183
  specification_version: 4
202
184
  summary: Test Kitchen driver for Azure Resource Manager.
203
185
  test_files: []
204
- has_rdoc: