kitchen-azurerm 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +10 -7
- data/lib/kitchen/driver/azurerm.rb +50 -10
- data/lib/kitchen/driver/credentials.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33d86c79946c5a652e0fd1603cdf14fdc179335e
|
4
|
+
data.tar.gz: 2e34e99b5bd2bbbe9cb92d87d4c42824469d0839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a380d0cbde90c599b7c233da84da7a241102126799b25e2f39db8f290954df8b8df9b4bf65e4a8e0dea004d9518dbb00eba5fb1832d0a5a87b0acb80cdb3db6
|
7
|
+
data.tar.gz: d7e753de49129469a15a9270a2ccb245516ff0b5347ead22f7e9aa130270c11e042c246cc401b02ce00ec0b4b68da85b9b6a4a93d24bb3dabd190c4b7865679b
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# kitchen-azurerm Changelog
|
2
|
+
|
3
|
+
## [0.2.4] - 2016-01-26
|
4
|
+
- Support Premium Storage and Boot Diagnostics (@stuartpreston)
|
5
|
+
- If deployment fails, show the message from the failing operation (@stuartpreston)
|
6
|
+
- Updated Windows 2008 R2 example (@stuartpreston)
|
2
7
|
|
3
8
|
## [0.2.3] - 2015-12-17
|
4
9
|
- ```kitchen create``` can now be executed multiple times, updating an existing deployment if an error occurs (@smurawski)
|
data/README.md
CHANGED
@@ -75,14 +75,16 @@ suites:
|
|
75
75
|
attributes:
|
76
76
|
```
|
77
77
|
|
78
|
-
###
|
79
|
-
|
78
|
+
### Concurrent execution
|
79
|
+
Concurrent execution of create/converge/destroy is supported via the --concurrency parameter. Each machine is created in it's own Azure Resource Group so has no shared lifecycle with the other machines in the test run. To take advantage of parallel execution use the following command:
|
80
80
|
|
81
|
-
```kitchen test --
|
81
|
+
```kitchen test --concurrency <n>```
|
82
|
+
|
83
|
+
Where <n> is the number of threads to create. Note that any failure (e.g. an AzureOperationError) will cause the whole test to fail, though resources already in creation will continue to be created.
|
82
84
|
|
83
85
|
### .kitchen.yml example 2 - Windows
|
84
86
|
|
85
|
-
Here's a further example ```.kitchen.yml``` file that will provision a Windows Server 2012 R2 instance, using WinRM as the transport. The resource created in Azure will enable itself for remote access at deployment time:
|
87
|
+
Here's a further example ```.kitchen.yml``` file that will provision a Windows Server 2012 R2 instance as well as a Windows Server 2008 R2 instance, using WinRM as the transport. The resource created in Azure will enable itself for remote access at deployment time:
|
86
88
|
|
87
89
|
**Note: Test Kitchen currently uses WinRM over HTTP rather than HTTPS. This means the temporary machine credentials traverse the internet in the clear. This will be changed once Test Kitchen fully supports WinRM over a secure channel.**
|
88
90
|
|
@@ -114,7 +116,6 @@ platforms:
|
|
114
116
|
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
|
115
117
|
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
|
116
118
|
winrm set winrm/config/service/auth '@{Basic="true"}'
|
117
|
-
netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any
|
118
119
|
transport:
|
119
120
|
name: winrm
|
120
121
|
suites:
|
@@ -158,8 +159,10 @@ data: Canonical UbuntuServer 15.10-DAILY 15.10.201509220 westeurope
|
|
158
159
|
info: vm image list command OK
|
159
160
|
```
|
160
161
|
|
161
|
-
### Additional
|
162
|
-
- driver_config also takes a username and password parameter, the defaults if these are not specified are "azure" and "P2ssw0rd" respectively.
|
162
|
+
### Additional parameters:
|
163
|
+
- Note that the ```driver_config``` section also takes a ```username``` and ```password``` parameter, the defaults if these are not specified are "azure" and "P2ssw0rd" respectively.
|
164
|
+
- The ```storage_account_type``` parameter defaults to 'Standard_LRS' and allows you to switch to premium storage (e.g. 'Premium_LRS')
|
165
|
+
- The ```enable_boot_diagnostics``` parameter defaults to 'true' and allows you to switch off boot diagnostics in case you are using premium storage.
|
163
166
|
|
164
167
|
## Contributing
|
165
168
|
|
@@ -33,6 +33,14 @@ module Kitchen
|
|
33
33
|
'vm'
|
34
34
|
end
|
35
35
|
|
36
|
+
default_config(:storage_account_type) do |_config|
|
37
|
+
'Standard_LRS'
|
38
|
+
end
|
39
|
+
|
40
|
+
default_config(:boot_diagnostics_enabled) do |_config|
|
41
|
+
'true'
|
42
|
+
end
|
43
|
+
|
36
44
|
default_config(:winrm_powershell_script) do |_config|
|
37
45
|
false
|
38
46
|
end
|
@@ -48,6 +56,8 @@ module Kitchen
|
|
48
56
|
deployment_parameters = {
|
49
57
|
location: config[:location],
|
50
58
|
vmSize: config[:machine_size],
|
59
|
+
storageAccountType: config[:storage_account_type],
|
60
|
+
bootDiagnosticsEnabled: config[:boot_diagnostics_enabled],
|
51
61
|
newStorageAccountName: "storage#{state[:uuid]}",
|
52
62
|
adminUsername: state[:username],
|
53
63
|
adminPassword: state[:password],
|
@@ -78,7 +88,7 @@ module Kitchen
|
|
78
88
|
begin
|
79
89
|
deployment_name = "deploy-#{state[:uuid]}"
|
80
90
|
info "Creating Deployment: #{deployment_name}"
|
81
|
-
resource_management_client.deployments.create_or_update(state[:azure_resource_group_name], deployment_name, deployment(
|
91
|
+
resource_management_client.deployments.create_or_update(state[:azure_resource_group_name], deployment_name, deployment(deployment_parameters)).value!
|
82
92
|
rescue ::MsRestAzure::AzureOperationError => operation_error
|
83
93
|
rest_error = operation_error.body['error']
|
84
94
|
deployment_active = rest_error['code'] == 'DeploymentActive'
|
@@ -124,21 +134,25 @@ module Kitchen
|
|
124
134
|
|
125
135
|
def template_for_transport_name
|
126
136
|
template = JSON.parse(virtual_machine_deployment_template)
|
127
|
-
if instance.transport.name.
|
137
|
+
if instance.transport.name.casecmp('winrm')
|
138
|
+
encoded_command = Base64.strict_encode64(enable_winrm_powershell_script)
|
139
|
+
command = command_to_execute
|
128
140
|
template['resources'].select { |h| h['type'] == 'Microsoft.Compute/virtualMachines' }.each do |resource|
|
129
|
-
resource['properties']['osProfile']['customData'] =
|
141
|
+
resource['properties']['osProfile']['customData'] = encoded_command
|
130
142
|
end
|
131
|
-
template['resources'] << JSON.parse(custom_script_extension_template)
|
143
|
+
template['resources'] << JSON.parse(custom_script_extension_template(command))
|
132
144
|
end
|
133
145
|
template.to_json
|
134
146
|
end
|
135
147
|
|
136
|
-
def deployment(
|
148
|
+
def deployment(parameters)
|
149
|
+
template = template_for_transport_name
|
137
150
|
deployment = ::Azure::ARM::Resources::Models::Deployment.new
|
138
151
|
deployment.properties = ::Azure::ARM::Resources::Models::DeploymentProperties.new
|
139
152
|
deployment.properties.mode = Azure::ARM::Resources::Models::DeploymentMode::Incremental
|
140
153
|
deployment.properties.template = JSON.parse(template)
|
141
154
|
deployment.properties.parameters = parameters_in_values_format(parameters)
|
155
|
+
debug(deployment.properties.template)
|
142
156
|
deployment
|
143
157
|
end
|
144
158
|
|
@@ -159,6 +173,15 @@ module Kitchen
|
|
159
173
|
end_provisioning_state_reached = end_provisioning_states.split(',').include?(deployment_provisioning_state)
|
160
174
|
end
|
161
175
|
info "Resource Template deployment reached end state of '#{deployment_provisioning_state}'."
|
176
|
+
show_failed_operations(resource_group, deployment_name)
|
177
|
+
end
|
178
|
+
|
179
|
+
def show_failed_operations(resource_group, deployment_name)
|
180
|
+
failed_operations = resource_management_client.deployment_operations.list(resource_group, deployment_name).value!
|
181
|
+
failed_operations.body.value.each do |val|
|
182
|
+
resource_code = val.properties.status_code
|
183
|
+
fail val.properties.status_message.inspect.to_s if resource_code != 'OK'
|
184
|
+
end
|
162
185
|
end
|
163
186
|
|
164
187
|
def list_outstanding_deployment_operations(resource_group, deployment_name)
|
@@ -201,7 +224,6 @@ module Kitchen
|
|
201
224
|
|
202
225
|
def enable_winrm_powershell_script
|
203
226
|
config[:winrm_powershell_script] || <<-PS1
|
204
|
-
New-SelfSignedCertificate -DnsName $env:COMPUTERNAME -CertStoreLocation Cert:\\LocalMachine\\My
|
205
227
|
$cert = New-SelfSignedCertificate -DnsName $env:COMPUTERNAME -CertStoreLocation Cert:\\LocalMachine\\My
|
206
228
|
$config = '@{CertificateThumbprint="' + $cert.Thumbprint + '"}'
|
207
229
|
winrm create winrm/config/listener?Address=*+Transport=HTTPS $config
|
@@ -212,7 +234,11 @@ New-NetFirewallRule -DisplayName "Windows Remote Management (HTTP-In)" -Name "Wi
|
|
212
234
|
PS1
|
213
235
|
end
|
214
236
|
|
215
|
-
def
|
237
|
+
def command_to_execute
|
238
|
+
'copy /y c:\\\\azuredata\\\\customdata.bin c:\\\\azuredata\\\\customdata.ps1 && powershell.exe -ExecutionPolicy Unrestricted -Command \\"start-process powershell.exe -verb runas -argumentlist c:\\\\azuredata\\\\customdata.ps1\\"'
|
239
|
+
end
|
240
|
+
|
241
|
+
def custom_script_extension_template(command)
|
216
242
|
<<-EOH
|
217
243
|
{
|
218
244
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
@@ -227,7 +253,7 @@ New-NetFirewallRule -DisplayName "Windows Remote Management (HTTP-In)" -Name "Wi
|
|
227
253
|
"type": "CustomScriptExtension",
|
228
254
|
"typeHandlerVersion": "1.4",
|
229
255
|
"settings": {
|
230
|
-
"commandToExecute": "
|
256
|
+
"commandToExecute": "#{command}"
|
231
257
|
}
|
232
258
|
}
|
233
259
|
}
|
@@ -310,6 +336,20 @@ New-NetFirewallRule -DisplayName "Windows Remote Management (HTTP-In)" -Name "Wi
|
|
310
336
|
"metadata": {
|
311
337
|
"description": "The vm name created inside of the resource group."
|
312
338
|
}
|
339
|
+
},
|
340
|
+
"storageAccountType": {
|
341
|
+
"type": "string",
|
342
|
+
"defaultValue": "Standard_LRS",
|
343
|
+
"metadata": {
|
344
|
+
"description": "The type of storage to use (e.g. Standard_LRS or Premium_LRS)."
|
345
|
+
}
|
346
|
+
},
|
347
|
+
"bootDiagnosticsEnabled": {
|
348
|
+
"type": "string",
|
349
|
+
"defaultValue": "true",
|
350
|
+
"metadata": {
|
351
|
+
"description": "Whether to enable (true) or disable (false) boot diagnostics. Default: true (requires Standard storage)."
|
352
|
+
}
|
313
353
|
}
|
314
354
|
},
|
315
355
|
"variables": {
|
@@ -319,7 +359,7 @@ New-NetFirewallRule -DisplayName "Windows Remote Management (HTTP-In)" -Name "Wi
|
|
319
359
|
"addressPrefix": "10.0.0.0/16",
|
320
360
|
"subnetName": "Subnet",
|
321
361
|
"subnetPrefix": "10.0.0.0/24",
|
322
|
-
"storageAccountType": "
|
362
|
+
"storageAccountType": "[parameters('storageAccountType')]",
|
323
363
|
"publicIPAddressName": "publicip",
|
324
364
|
"publicIPAddressType": "Dynamic",
|
325
365
|
"vmStorageAccountContainerName": "vhds",
|
@@ -441,7 +481,7 @@ New-NetFirewallRule -DisplayName "Windows Remote Management (HTTP-In)" -Name "Wi
|
|
441
481
|
},
|
442
482
|
"diagnosticsProfile": {
|
443
483
|
"bootDiagnostics": {
|
444
|
-
"enabled": "
|
484
|
+
"enabled": "[parameters('bootDiagnosticsEnabled')]",
|
445
485
|
"storageUri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net')]"
|
446
486
|
}
|
447
487
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-azurerm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Preston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inifile
|