knife-azure 3.0.1 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/azure/resource_management/ARM_interface.rb +4 -6
- data/lib/azure/resource_management/windows_credentials.rb +3 -4
- data/lib/azure/service_management/certificate.rb +2 -2
- data/lib/chef/knife/azurerm_server_delete.rb +1 -1
- data/lib/chef/knife/bootstrap_azure.rb +7 -7
- data/lib/chef/knife/helpers/azure_base.rb +1 -3
- data/lib/chef/knife/helpers/azurerm_base.rb +6 -8
- data/lib/knife-azure/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17210f56bc1b6b7efd7152512c8ee5c416d0eb6afed2139f757bbd96f20baaa8
|
4
|
+
data.tar.gz: 3cba997f30e540035c9b4495326c09e70d45a3c0d7c9f84d01377168bf73837f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 884f5d06b3ad5159a97a81434e508185c64c0850f135b2b71094f70076aeecc0b7670f58d83215531344b903820caefeacec85aee53f7d254cbbbe22eca21548
|
7
|
+
data.tar.gz: f57c4e8b5cad7a9437a4292c1c41b2ff668d9c42f32c322ef1f1ac7fe87d735b8fff7c8d2859500958f3e11616487e0606960f75d39c7948fbdc0fdb46723924
|
@@ -323,7 +323,7 @@ module Azure
|
|
323
323
|
else
|
324
324
|
ui.log("Creating ResourceGroup....\n\n")
|
325
325
|
resource_group = create_resource_group(params)
|
326
|
-
Chef::Log.info("ResourceGroup creation
|
326
|
+
Chef::Log.info("ResourceGroup creation successful.")
|
327
327
|
Chef::Log.info("Resource Group name is: #{resource_group.name}")
|
328
328
|
Chef::Log.info("Resource Group ID is: #{resource_group.id}")
|
329
329
|
end
|
@@ -355,7 +355,7 @@ module Azure
|
|
355
355
|
|
356
356
|
ui.log("Creating Virtual Machine....")
|
357
357
|
deployment = create_virtual_machine_using_template(params)
|
358
|
-
ui.log("Virtual Machine creation
|
358
|
+
ui.log("Virtual Machine creation successful.") unless deployment.nil?
|
359
359
|
|
360
360
|
unless deployment.nil?
|
361
361
|
ui.log("Deployment name is: #{deployment.name}")
|
@@ -422,8 +422,7 @@ module Azure
|
|
422
422
|
deploy_params = Deployment.new
|
423
423
|
deploy_params.properties = deploy_prop
|
424
424
|
|
425
|
-
|
426
|
-
deployment
|
425
|
+
resource_management_client.deployments.create_or_update(params[:azure_resource_group_name], "#{params[:azure_vm_name]}_deploy", deploy_params)
|
427
426
|
end
|
428
427
|
|
429
428
|
def create_vm_extension(params)
|
@@ -467,8 +466,7 @@ module Azure
|
|
467
466
|
params[:chef_extension]
|
468
467
|
).last.name
|
469
468
|
ext_version_split_values = ext_version.split(".")
|
470
|
-
|
471
|
-
ext_version
|
469
|
+
ext_version_split_values[0] + "." + ext_version_split_values[1]
|
472
470
|
end
|
473
471
|
|
474
472
|
def delete_resource_group(resource_group_name)
|
@@ -123,8 +123,8 @@ module Azure
|
|
123
123
|
def target_name
|
124
124
|
# cmdkey command is used for accessing windows credential manager.
|
125
125
|
# Multiple credentials get created in windows credential manager for a single Azure account in xplat-cli
|
126
|
-
# One of them is for common
|
127
|
-
# Others end with --0-x,--1-x,--2-x etc, where x represents the total no. of
|
126
|
+
# One of them is for common tenant id, which can't be used
|
127
|
+
# Others end with --0-x,--1-x,--2-x etc, where x represents the total no. of credentials across which the token is divided
|
128
128
|
# The one ending with --0-x has the complete accessToken in the credentialBlob.
|
129
129
|
# Refresh Token is split across both credentials (ending with --0-x and --1-x).
|
130
130
|
# Xplat splits the credentials based on the number of bytes of the tokens.
|
@@ -150,8 +150,7 @@ module Azure
|
|
150
150
|
|
151
151
|
# If "azure login" is run for multiple users, there will be multiple credentials
|
152
152
|
# Picking up the latest logged in user's credentials
|
153
|
-
|
154
|
-
latest_target
|
153
|
+
latest_credential_target target_names
|
155
154
|
end
|
156
155
|
|
157
156
|
def latest_credential_target(targets)
|
@@ -85,7 +85,7 @@ module Azure
|
|
85
85
|
ca.add_extension(ef.create_extension("keyUsage", "keyCertSign, cRLSign", true))
|
86
86
|
ca.add_extension(ef.create_extension("subjectKeyIdentifier", "hash", false))
|
87
87
|
ca.add_extension(ef.create_extension("authorityKeyIdentifier", "keyid:always", false))
|
88
|
-
ca.sign(key, OpenSSL::Digest
|
88
|
+
ca.sign(key, OpenSSL::Digest.new("SHA256"))
|
89
89
|
# Generate the SHA1 fingerprint of the der format of the X 509 certificate
|
90
90
|
@fingerprint = OpenSSL::Digest::SHA1.new(ca.to_der)
|
91
91
|
# Create the pfx format of the certificate
|
@@ -216,7 +216,7 @@ module Azure
|
|
216
216
|
cert.add_extension(ef.create_extension("subjectKeyIdentifier", "hash", false))
|
217
217
|
cert.add_extension(ef.create_extension("authorityKeyIdentifier", "keyid:always", false))
|
218
218
|
cert.add_extension(ef.create_extension("extendedKeyUsage", "1.3.6.1.5.5.7.3.1", false))
|
219
|
-
cert.sign(rsa_key, OpenSSL::Digest
|
219
|
+
cert.sign(rsa_key, OpenSSL::Digest.new("SHA1"))
|
220
220
|
@thumbprint = OpenSSL::Digest::SHA1.new(cert.to_der)
|
221
221
|
cert
|
222
222
|
end
|
@@ -51,7 +51,7 @@ class Chef
|
|
51
51
|
long: "--delete-resource-group",
|
52
52
|
boolean: true,
|
53
53
|
default: false,
|
54
|
-
description: "Deletes corresponding resource group along with
|
54
|
+
description: "Deletes corresponding resource group along with Virtual Machine."
|
55
55
|
|
56
56
|
# Extracted from Chef::Knife.delete_object, because it has a
|
57
57
|
# confirmation step built in... By specifying the '--purge'
|
@@ -139,10 +139,10 @@ class Chef
|
|
139
139
|
ext_params
|
140
140
|
end
|
141
141
|
|
142
|
-
def wait_until_extension_available(extension_deploy_start_time,
|
143
|
-
|
144
|
-
if
|
145
|
-
## extension
|
142
|
+
def wait_until_extension_available(extension_deploy_start_time, extension_availability_wait_timeout)
|
143
|
+
extension_availability_wait_time = ((Time.now - extension_deploy_start_time) / 60).round
|
144
|
+
if extension_availability_wait_time <= extension_availability_wait_timeout
|
145
|
+
## extension availability wait time has not exceeded the maximum threshold set for the wait timeout ##
|
146
146
|
my_role = nil
|
147
147
|
sleep_and_wait = false
|
148
148
|
deployment = fetch_deployment
|
@@ -178,12 +178,12 @@ class Chef
|
|
178
178
|
sleep 30
|
179
179
|
wait_until_extension_available(
|
180
180
|
extension_deploy_start_time,
|
181
|
-
|
181
|
+
extension_availability_wait_timeout
|
182
182
|
)
|
183
183
|
end
|
184
184
|
else
|
185
|
-
## extension
|
186
|
-
raise "\nUnable to fetch chef-client run logs as Chef Extension seems to be unavailable even after #{
|
185
|
+
## extension availability wait time exceeded maximum threshold set for the wait timeout ##
|
186
|
+
raise "\nUnable to fetch chef-client run logs as Chef Extension seems to be unavailable even after #{extension_availability_wait_timeout} minutes of its deployment.\n"
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
@@ -292,9 +292,7 @@ class Chef
|
|
292
292
|
|
293
293
|
def fetch_deployment
|
294
294
|
deployment_name = service.deployment_name(config[:azure_dns_name])
|
295
|
-
|
296
|
-
|
297
|
-
deployment
|
295
|
+
service.deployment("hostedservices/#{config[:azure_dns_name]}/deployments/#{deployment_name}")
|
298
296
|
end
|
299
297
|
|
300
298
|
def fetch_role
|
@@ -93,8 +93,7 @@ class Chef
|
|
93
93
|
token_details = token_details_for_linux
|
94
94
|
end
|
95
95
|
|
96
|
-
|
97
|
-
token_details
|
96
|
+
check_token_validity(token_details)
|
98
97
|
end
|
99
98
|
|
100
99
|
def get_azure_cli_version
|
@@ -122,8 +121,7 @@ class Chef
|
|
122
121
|
home_dir = File.expand_path("~")
|
123
122
|
file = File.read(home_dir + "/.azure/accessTokens.json")
|
124
123
|
file = JSON.parse(file)
|
125
|
-
|
126
|
-
token_details
|
124
|
+
{ tokentype: file[-1]["tokenType"], user: file[-1]["userId"], token: file[-1]["accessToken"], clientid: file[-1]["_clientId"], expiry_time: file[-1]["expiresOn"], refreshtoken: file[-1]["refreshToken"] }
|
127
125
|
end
|
128
126
|
|
129
127
|
def is_token_valid?(token_details)
|
@@ -219,7 +217,7 @@ class Chef
|
|
219
217
|
def msg_server_summary(server)
|
220
218
|
puts "\n\n"
|
221
219
|
if server.provisioningstate == "Succeeded"
|
222
|
-
Chef::Log.info("Server creation went
|
220
|
+
Chef::Log.info("Server creation went successful.")
|
223
221
|
puts "\nServer Details are:\n"
|
224
222
|
|
225
223
|
msg_pair("Server ID", server.id)
|
@@ -240,7 +238,7 @@ class Chef
|
|
240
238
|
puts "\n\n"
|
241
239
|
|
242
240
|
if server.resources.provisioning_state == "Succeeded"
|
243
|
-
Chef::Log.info("Server Extension creation went
|
241
|
+
Chef::Log.info("Server Extension creation went successful.")
|
244
242
|
puts "\nServer Extension Details are:\n"
|
245
243
|
|
246
244
|
msg_pair("Server Extension ID", server.resources.id)
|
@@ -278,10 +276,10 @@ class Chef
|
|
278
276
|
|
279
277
|
if !is_image_windows?
|
280
278
|
if (config[:azure_vm_name].match /^(?=.*[a-zA-Z-])([a-zA-z0-9-]{1,64})$/).nil?
|
281
|
-
raise ArgumentError, "VM name can only contain alphanumeric and hyphen(-) characters and
|
279
|
+
raise ArgumentError, "VM name can only contain alphanumeric and hyphen(-) characters and maximum length cannot exceed 64 characters."
|
282
280
|
end
|
283
281
|
elsif (config[:azure_vm_name].match /^(?=.*[a-zA-Z-])([a-zA-z0-9-]{1,15})$/).nil?
|
284
|
-
raise ArgumentError, "VM name can only contain alphanumeric and hyphen(-) characters and
|
282
|
+
raise ArgumentError, "VM name can only contain alphanumeric and hyphen(-) characters and maximum length cannot exceed 15 characters."
|
285
283
|
end
|
286
284
|
|
287
285
|
if config[:server_count].to_i > 5
|
data/lib/knife-azure/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-azure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barry Davis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|