knife-azure 2.0.17 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/azure/azure_interface.rb +1 -1
  3. data/lib/azure/custom_errors.rb +1 -1
  4. data/lib/azure/helpers.rb +1 -1
  5. data/lib/azure/resource_management/ARM_deployment_template.rb +1 -1
  6. data/lib/azure/resource_management/ARM_interface.rb +1 -1
  7. data/lib/azure/resource_management/vnet_config.rb +1 -1
  8. data/lib/azure/resource_management/windows_credentials.rb +1 -1
  9. data/lib/azure/service_management/ASM_interface.rb +1 -1
  10. data/lib/azure/service_management/ag.rb +1 -1
  11. data/lib/azure/service_management/certificate.rb +2 -2
  12. data/lib/azure/service_management/connection.rb +1 -1
  13. data/lib/azure/service_management/deploy.rb +1 -1
  14. data/lib/azure/service_management/disk.rb +1 -1
  15. data/lib/azure/service_management/host.rb +1 -1
  16. data/lib/azure/service_management/image.rb +1 -1
  17. data/lib/azure/service_management/loadbalancer.rb +1 -1
  18. data/lib/azure/service_management/rest.rb +1 -1
  19. data/lib/azure/service_management/role.rb +1 -1
  20. data/lib/azure/service_management/storageaccount.rb +1 -1
  21. data/lib/azure/service_management/utility.rb +1 -1
  22. data/lib/azure/service_management/vnet.rb +1 -1
  23. data/lib/chef/knife/azure_ag_create.rb +4 -4
  24. data/lib/chef/knife/azure_ag_list.rb +1 -1
  25. data/lib/chef/knife/azure_image_list.rb +3 -3
  26. data/lib/chef/knife/azure_internal-lb_create.rb +5 -5
  27. data/lib/chef/knife/azure_internal-lb_list.rb +1 -1
  28. data/lib/chef/knife/azure_server_create.rb +70 -70
  29. data/lib/chef/knife/azure_server_delete.rb +7 -7
  30. data/lib/chef/knife/azure_server_list.rb +1 -1
  31. data/lib/chef/knife/azure_server_show.rb +1 -1
  32. data/lib/chef/knife/azure_vnet_create.rb +5 -5
  33. data/lib/chef/knife/azure_vnet_list.rb +1 -1
  34. data/lib/chef/knife/azurerm_server_create.rb +43 -43
  35. data/lib/chef/knife/azurerm_server_delete.rb +6 -6
  36. data/lib/chef/knife/azurerm_server_list.rb +2 -2
  37. data/lib/chef/knife/azurerm_server_show.rb +2 -2
  38. data/lib/chef/knife/bootstrap/bootstrapper.rb +29 -35
  39. data/lib/chef/knife/bootstrap/common_bootstrap_options.rb +3 -5
  40. data/lib/chef/knife/bootstrap_azure.rb +8 -8
  41. data/lib/chef/knife/bootstrap_azurerm.rb +5 -5
  42. data/lib/chef/knife/helpers/azure_base.rb +46 -55
  43. data/lib/chef/knife/helpers/azurerm_base.rb +30 -39
  44. data/lib/knife-azure/version.rb +2 -2
  45. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55796c18ca369c438d235edbbe415025af68ad22b27ca3a9a41ab926fbb5c0ac
4
- data.tar.gz: dfd5cc5a0bc90d0b42994a417deedd75041f224e08ac63a62049b972c362246b
3
+ metadata.gz: 9e88a7081dafbf64000602515bbcf0d7a94626b01b10b0eeceacfc9422af357a
4
+ data.tar.gz: 1b5bcb5fa0b5d4b714786960a31dec0227341dffaa78912d659f815333c07f57
5
5
  SHA512:
6
- metadata.gz: 411c2d695a55b7b2bee0ebfac1883b61ffe957388e02f391f2f6f6c1b7a907600d25f9a8768b5706e3df9c564462e10a606bed5714593082dc8491b87cda00e7
7
- data.tar.gz: b1d033dd7e856af827b365c5018b5ff90a4f91409c318b52146476f79f8c32a6c2b53d68456645c2db7c1f9b7cc7536fb519622cd5b969fb5a08ffa1fb9aed80
6
+ metadata.gz: 1fc54ec3e79cc6334b5a2963474864be613e4b181ce5bab21a95773b0dea1de5a3ea3aab1dada8650df5c1f339e99973ac857d0d5e2870fc98cdbd164199744b
7
+ data.tar.gz: 1580127f2c555cd0112b18acb703114a9c5ebf6fbfe596573a3411540dc9982d54edc668fc6fd0b4190fb6dbbf9e378f8a9426945538a909c5036c0555d7232a
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
2
+ # Copyright:: Copyright (c) Chef Software Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
2
+ # Copyright:: Copyright (c) Chef Software Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: vasundhara.jagdale@clogeny.com
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Nimisha Sharad (nimisha.sharad@clogeny.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
2
+ # Copyright:: Copyright (c) Chef Software Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Aliasgar Batterywala (aliasgar.batterywala@clogeny.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Nimisha Sharad (nimisha.sharad@clogeny.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
2
+ # Copyright:: Copyright (c) Chef Software Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Jeff Mendoza (jeffmendoza@live.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Mukta Aphale (mukta.aphale@clogeny.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -142,7 +142,7 @@ module Azure
142
142
  puts "Certificate Thumbprint: #{@thumbprint.to_s.upcase}"
143
143
  puts "*" * 70
144
144
 
145
- Chef::Config[:knife][:ca_trust_file] = file_path + ".pem" if Chef::Config[:knife][:ca_trust_file].nil?
145
+ config[:ca_trust_file] = file_path + ".pem" if config[:ca_trust_file].nil?
146
146
  cert_data = File.read (file_path + ".b64")
147
147
  add_certificate cert_data, @winrm_cert_passphrase, "pfx", cert_params[:azure_dns_name]
148
148
  @thumbprint
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Aiman Alsari (aiman.alsari@gmail.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Jeff Mendoza (jeffmendoza@live.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Jeff Mendoza (jeffmendoza@live.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -50,9 +50,9 @@ class Chef
50
50
  :azure_service_location)
51
51
 
52
52
  params = {
53
- azure_ag_name: locate_config_value(:azure_affinity_group),
54
- azure_ag_desc: locate_config_value(:azure_ag_desc),
55
- azure_location: locate_config_value(:azure_service_location),
53
+ azure_ag_name: config[:azure_affinity_group],
54
+ azure_ag_desc: config[:azure_ag_desc],
55
+ azure_location: config[:azure_service_location],
56
56
  }
57
57
 
58
58
  rsp = service.create_affinity_group(params)
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Jeff Mendoza (jeffmendoza@live.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -2,7 +2,7 @@
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
4
  # Author:: Adam Jacob (<adam@chef.io>)
5
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,7 +40,7 @@ class Chef
40
40
  validate_asm_keys!
41
41
  items = service.list_images
42
42
 
43
- image_labels = !locate_config_value(:show_all_fields) ? %w{Name OS Location} : %w{Name Category Label OS Location}
43
+ image_labels = !config[:show_all_fields] ? %w{Name OS Location} : %w{Name Category Label OS Location}
44
44
  image_list = image_labels.map { |label| ui.color(label, :bold) }
45
45
 
46
46
  image_items = image_labels.map(&:downcase)
@@ -49,7 +49,7 @@ class Chef
49
49
  end
50
50
 
51
51
  puts "\n"
52
- puts ui.list(image_list, :uneven_columns_across, !locate_config_value(:show_all_fields) ? 3 : 5)
52
+ puts ui.list(image_list, :uneven_columns_across, !config[:show_all_fields] ? 3 : 5)
53
53
  end
54
54
  end
55
55
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Aiman Alsari (aiman.alsari@gmail.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -50,10 +50,10 @@ class Chef
50
50
  validate_asm_keys!(:azure_load_balancer)
51
51
 
52
52
  params = {
53
- azure_load_balancer: locate_config_value(:azure_load_balancer),
54
- azure_lb_static_vip: locate_config_value(:azure_lb_static_vip),
55
- azure_subnet_name: locate_config_value(:azure_subnet_name),
56
- azure_dns_name: locate_config_value(:azure_dns_name),
53
+ azure_load_balancer: config[:azure_load_balancer],
54
+ azure_lb_static_vip: config[:azure_lb_static_vip],
55
+ azure_subnet_name: config[:azure_subnet_name],
56
+ azure_dns_name: config[:azure_dns_name],
57
57
  }
58
58
 
59
59
  rsp = service.create_internal_lb(params)
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Aiman Alsari (aiman.alsari@gmail.com)
3
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -2,7 +2,7 @@
2
2
  # Author:: Barry Davis (barryd@jetstreamsoftware.com)
3
3
  # Author:: Adam Jacob (<adam@chef.io>)
4
4
  # Author:: Seth Chisamore (<schisamo@chef.io>)
5
- # Copyright:: Copyright 2010-2019, Chef Software Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -196,7 +196,7 @@ class Chef
196
196
 
197
197
  config[:connection_port] = server_def[:port]
198
198
  config[:connection_protocol] = server_def[:connection_protocol]
199
- config[:chef_node_name] = locate_config_value(:chef_node_name) || server_name
199
+ config[:chef_node_name] = config[:chef_node_name] || server_name
200
200
  rescue => error
201
201
  ui.error("Something went wrong. Please use -VV option for more details.")
202
202
  Chef::Log.debug(error.backtrace.join("\n").to_s)
@@ -216,7 +216,7 @@ class Chef
216
216
  alias host_descriptor server_name
217
217
 
218
218
  def plugin_finalize
219
- if locate_config_value(:connection_protocol) == "cloud-api" && locate_config_value(:extended_logs)
219
+ if config[:connection_protocol] == "cloud-api" && config[:extended_logs]
220
220
  print "\nWaiting for the first chef-client run"
221
221
  fetch_chef_client_logs(Time.now, 30)
222
222
  end
@@ -228,8 +228,8 @@ class Chef
228
228
  def wait_until_virtual_machine_ready(retry_interval_in_seconds = 30)
229
229
  vm_status = nil
230
230
  begin
231
- azure_vm_startup_timeout = locate_config_value(:azure_vm_startup_timeout).to_i
232
- azure_vm_ready_timeout = locate_config_value(:azure_vm_ready_timeout).to_i
231
+ azure_vm_startup_timeout = config[:azure_vm_startup_timeout].to_i
232
+ azure_vm_ready_timeout = config[:azure_vm_ready_timeout].to_i
233
233
  vm_status = wait_for_virtual_machine_state(:vm_status_provisioning, azure_vm_startup_timeout, retry_interval_in_seconds)
234
234
  if vm_status != :vm_status_ready
235
235
  begin
@@ -242,7 +242,7 @@ class Chef
242
242
 
243
243
  msg_server_summary(@server)
244
244
 
245
- if locate_config_value(:connection_protocol) == "cloud-api"
245
+ if config[:connection_protocol] == "cloud-api"
246
246
  extension_status = wait_for_resource_extension_state(:wagent_provisioning, 5, retry_interval_in_seconds)
247
247
 
248
248
  if extension_status != :extension_installing
@@ -323,7 +323,7 @@ class Chef
323
323
  end
324
324
 
325
325
  def get_virtual_machine_status
326
- @server = service.get_role_server(locate_config_value(:azure_dns_name), locate_config_value(:azure_vm_name))
326
+ @server = service.get_role_server(config[:azure_dns_name], config[:azure_vm_name])
327
327
  if @server.nil?
328
328
  :vm_status_not_detected
329
329
  else
@@ -340,14 +340,14 @@ class Chef
340
340
  end
341
341
 
342
342
  def get_extension_status
343
- deployment_name = service.deployment_name(locate_config_value(:azure_dns_name))
344
- deployment = service.deployment("hostedservices/#{locate_config_value(:azure_dns_name)}/deployments/#{deployment_name}")
343
+ deployment_name = service.deployment_name(config[:azure_dns_name])
344
+ deployment = service.deployment("hostedservices/#{config[:azure_dns_name]}/deployments/#{deployment_name}")
345
345
  extension_status = {}
346
346
 
347
347
  if deployment.at_css("Deployment Name") != nil
348
348
  role_list_xml = deployment.css("RoleInstanceList RoleInstance")
349
349
  role_list_xml.each do |role|
350
- if role.at_css("RoleName").text == locate_config_value(:azure_vm_name)
350
+ if role.at_css("RoleName").text == config[:azure_vm_name]
351
351
  lnx_waagent_fail_msg = "Failed to deserialize the status reported by the Guest Agent"
352
352
  waagent_status_msg = role.at_css("GuestAgentStatus FormattedMessage Message").text
353
353
  if role.at_css("GuestAgentStatus Status").text == "Ready"
@@ -384,32 +384,32 @@ class Chef
384
384
 
385
385
  def create_server_def
386
386
  server_def = {
387
- azure_storage_account: locate_config_value(:azure_storage_account),
388
- azure_api_host_name: locate_config_value(:azure_api_host_name),
389
- azure_dns_name: locate_config_value(:azure_dns_name),
390
- azure_vm_name: locate_config_value(:azure_vm_name),
391
- azure_service_location: locate_config_value(:azure_service_location),
392
- azure_os_disk_name: locate_config_value(:azure_os_disk_name),
393
- azure_source_image: locate_config_value(:azure_source_image),
394
- azure_vm_size: locate_config_value(:azure_vm_size),
395
- tcp_endpoints: locate_config_value(:tcp_endpoints),
396
- udp_endpoints: locate_config_value(:udp_endpoints),
397
- connection_protocol: locate_config_value(:connection_protocol),
398
- azure_connect_to_existing_dns: locate_config_value(:azure_connect_to_existing_dns),
399
- connection_user: locate_config_value(:connection_user),
400
- azure_availability_set: locate_config_value(:azure_availability_set),
401
- azure_affinity_group: locate_config_value(:azure_affinity_group),
402
- azure_network_name: locate_config_value(:azure_network_name),
403
- azure_subnet_name: locate_config_value(:azure_subnet_name),
404
- ssl_cert_fingerprint: locate_config_value(:thumbprint),
405
- cert_path: locate_config_value(:cert_path),
406
- cert_password: locate_config_value(:cert_passphrase),
407
- winrm_ssl: locate_config_value(:winrm_ssl),
408
- winrm_max_timeout: locate_config_value(:winrm_max_timeout).to_i * 60 * 1000, # converting minutes to milliseconds
409
- winrm_max_memory_per_shell: locate_config_value(:winrm_max_memory_per_shell),
387
+ azure_storage_account: config[:azure_storage_account],
388
+ azure_api_host_name: config[:azure_api_host_name],
389
+ azure_dns_name: config[:azure_dns_name],
390
+ azure_vm_name: config[:azure_vm_name],
391
+ azure_service_location: config[:azure_service_location],
392
+ azure_os_disk_name: config[:azure_os_disk_name],
393
+ azure_source_image: config[:azure_source_image],
394
+ azure_vm_size: config[:azure_vm_size],
395
+ tcp_endpoints: config[:tcp_endpoints],
396
+ udp_endpoints: config[:udp_endpoints],
397
+ connection_protocol: config[:connection_protocol],
398
+ azure_connect_to_existing_dns: config[:azure_connect_to_existing_dns],
399
+ connection_user: config[:connection_user],
400
+ azure_availability_set: config[:azure_availability_set],
401
+ azure_affinity_group: config[:azure_affinity_group],
402
+ azure_network_name: config[:azure_network_name],
403
+ azure_subnet_name: config[:azure_subnet_name],
404
+ ssl_cert_fingerprint: config[:thumbprint],
405
+ cert_path: config[:cert_path],
406
+ cert_password: config[:cert_passphrase],
407
+ winrm_ssl: config[:winrm_ssl],
408
+ winrm_max_timeout: config[:winrm_max_timeout].to_i * 60 * 1000, # converting minutes to milliseconds
409
+ winrm_max_memory_per_shell: config[:winrm_max_memory_per_shell],
410
410
  }
411
411
 
412
- if locate_config_value(:connection_protocol) == "cloud-api"
412
+ if config[:connection_protocol] == "cloud-api"
413
413
  server_def[:chef_extension] = get_chef_extension_name
414
414
  server_def[:chef_extension_publisher] = get_chef_extension_publisher
415
415
  server_def[:chef_extension_version] = get_chef_extension_version
@@ -420,20 +420,20 @@ class Chef
420
420
  # We can specify the AdminUsername after API version 2013-03-01. However, in this API version,
421
421
  # the AdminUsername is a required parameter.
422
422
  # Also, the user name cannot be Administrator, Admin, Admin1 etc, for enhanced security (provided by Azure)
423
- if locate_config_value(:connection_user).nil? || locate_config_value(:connection_user).downcase =~ /admin*/
423
+ if config[:connection_user].nil? || config[:connection_user].downcase =~ /admin*/
424
424
  ui.error("Connection User is compulsory parameter and it cannot be named 'admin*'")
425
425
  exit 1
426
426
  # take cares of when user name contains domain
427
427
  # azure add role api doesn't support '\\' in user name
428
- elsif locate_config_value(:connection_user).split('\\').length.eql?(2)
429
- server_def[:connection_user] = locate_config_value(:connection_user).split('\\')[1]
428
+ elsif config[:connection_user].split('\\').length.eql?(2)
429
+ server_def[:connection_user] = config[:connection_user].split('\\')[1]
430
430
  end
431
431
  else
432
- unless locate_config_value(:connection_user)
432
+ unless config[:connection_user]
433
433
  ui.error("Connection User is compulsory parameter")
434
434
  exit 1
435
435
  end
436
- unless locate_config_value(:connection_password) || locate_config_value(:ssh_identity_file)
436
+ unless config[:connection_password] || config[:ssh_identity_file]
437
437
  ui.error("Specify either SSH Key or SSH Password")
438
438
  exit 1
439
439
  end
@@ -442,52 +442,52 @@ class Chef
442
442
 
443
443
  if is_image_windows?
444
444
  server_def[:os_type] = "Windows"
445
- server_def[:admin_password] = locate_config_value(:connection_password)
446
- server_def[:connection_protocol] = locate_config_value(:connection_protocol) || "winrm"
445
+ server_def[:admin_password] = config[:connection_password]
446
+ server_def[:connection_protocol] = config[:connection_protocol] || "winrm"
447
447
  else
448
448
  server_def[:os_type] = "Linux"
449
- server_def[:connection_protocol] = locate_config_value(:connection_protocol).nil? || locate_config_value(:connection_protocol) == "winrm" ? "ssh" : locate_config_value(:connection_protocol)
450
- server_def[:connection_user] = locate_config_value(:connection_user)
451
- server_def[:connection_password] = locate_config_value(:connection_password)
452
- server_def[:ssh_identity_file] = locate_config_value(:ssh_identity_file)
453
- server_def[:identity_file_passphrase] = locate_config_value(:identity_file_passphrase)
449
+ server_def[:connection_protocol] = config[:connection_protocol].nil? || config[:connection_protocol] == "winrm" ? "ssh" : config[:connection_protocol]
450
+ server_def[:connection_user] = config[:connection_user]
451
+ server_def[:connection_password] = config[:connection_password]
452
+ server_def[:ssh_identity_file] = config[:ssh_identity_file]
453
+ server_def[:identity_file_passphrase] = config[:identity_file_passphrase]
454
454
  end
455
455
 
456
- azure_connect_to_existing_dns = locate_config_value(:azure_connect_to_existing_dns)
456
+ azure_connect_to_existing_dns = config[:azure_connect_to_existing_dns]
457
457
  if is_image_windows? && server_def[:connection_protocol] == "winrm"
458
- port = locate_config_value(:connection_port) || "5985"
459
- port = locate_config_value(:connection_port) || Random.rand(64000) + 1000 if azure_connect_to_existing_dns
458
+ port = config[:connection_port] || "5985"
459
+ port = config[:connection_port] || Random.rand(64000) + 1000 if azure_connect_to_existing_dns
460
460
  elsif server_def[:connection_protocol] == "ssh"
461
- port = locate_config_value(:connection_port) || "22"
462
- port = locate_config_value(:connection_port) || Random.rand(64000) + 1000 if azure_connect_to_existing_dns
461
+ port = config[:connection_port] || "22"
462
+ port = config[:connection_port] || Random.rand(64000) + 1000 if azure_connect_to_existing_dns
463
463
  end
464
464
 
465
465
  server_def[:port] = port
466
466
 
467
- server_def[:is_vm_image] = service.vm_image?(locate_config_value(:azure_source_image))
468
- server_def[:azure_domain_name] = locate_config_value(:azure_domain_name) if locate_config_value(:azure_domain_name)
467
+ server_def[:is_vm_image] = service.vm_image?(config[:azure_source_image])
468
+ server_def[:azure_domain_name] = config[:azure_domain_name] if config[:azure_domain_name]
469
469
 
470
- if locate_config_value(:azure_domain_user)
470
+ if config[:azure_domain_user]
471
471
  # extract domain name since it should be part of username
472
- case locate_config_value(:azure_domain_user)
472
+ case config[:azure_domain_user]
473
473
  when /(\S+)\\(.+)/ # format - fully-qualified-DNS-domain\username
474
- server_def[:azure_domain_name] = $1 if locate_config_value(:azure_domain_name).nil?
474
+ server_def[:azure_domain_name] = $1 if config[:azure_domain_name].nil?
475
475
  server_def[:azure_user_domain_name] = $1
476
476
  server_def[:azure_domain_user] = $2
477
477
  when /(.+)@(\S+)/ # format - user@fully-qualified-DNS-domain
478
- server_def[:azure_domain_name] = $2 if locate_config_value(:azure_domain_name).nil?
478
+ server_def[:azure_domain_name] = $2 if config[:azure_domain_name].nil?
479
479
  server_def[:azure_user_domain_name] = $2
480
480
  server_def[:azure_domain_user] = $1
481
481
  else
482
- if locate_config_value(:azure_domain_name).nil?
482
+ if config[:azure_domain_name].nil?
483
483
  ui.error('--azure-domain-name should be specified if --azure-domain-user is not in one of the following formats: fully-qualified-DNS-domain\username, user@fully-qualified-DNS-domain')
484
484
  exit 1
485
485
  end
486
- server_def[:azure_domain_user] = locate_config_value(:azure_domain_user)
486
+ server_def[:azure_domain_user] = config[:azure_domain_user]
487
487
  end
488
488
  end
489
- server_def[:azure_domain_passwd] = locate_config_value(:azure_domain_passwd)
490
- server_def[:azure_domain_ou_dn] = locate_config_value(:azure_domain_ou_dn)
489
+ server_def[:azure_domain_passwd] = config[:azure_domain_passwd]
490
+ server_def[:azure_domain_ou_dn] = config[:azure_domain_ou_dn]
491
491
 
492
492
  server_def
493
493
  end
@@ -499,17 +499,17 @@ class Chef
499
499
  end
500
500
 
501
501
  def set_configs
502
- unless locate_config_value(:connection_user).nil?
503
- config[:connection_user] = locate_config_value(:connection_user)
502
+ unless config[:connection_user].nil?
503
+ config[:connection_user] = config[:connection_user]
504
504
  end
505
505
 
506
- unless locate_config_value(:connection_password).nil?
507
- config[:connection_password] = locate_config_value(:connection_password)
506
+ unless config[:connection_password].nil?
507
+ config[:connection_password] = config[:connection_password]
508
508
  end
509
509
 
510
- config[:azure_dns_name] = get_dns_name(locate_config_value(:azure_dns_name))
511
- config[:azure_vm_name] = locate_config_value(:azure_dns_name) unless locate_config_value(:azure_vm_name)
512
- config[:chef_node_name] = locate_config_value(:azure_vm_name) unless locate_config_value(:chef_node_name)
510
+ config[:azure_dns_name] = get_dns_name(config[:azure_dns_name])
511
+ config[:azure_vm_name] = config[:azure_dns_name] unless config[:azure_vm_name]
512
+ config[:chef_node_name] = config[:azure_vm_name] unless config[:chef_node_name]
513
513
  end
514
514
 
515
515
  # This is related to Windows VM's specifically and computer name
@@ -520,10 +520,10 @@ class Chef
520
520
  def get_dns_name(azure_dns_name, prefix = "az-")
521
521
  return azure_dns_name unless azure_dns_name.nil?
522
522
 
523
- if locate_config_value(:azure_vm_name).nil?
523
+ if config[:azure_vm_name].nil?
524
524
  (prefix + SecureRandom.hex((MAX_VM_NAME_CHARACTERS - prefix.length) / 2))
525
525
  else
526
- locate_config_value(:azure_vm_name)
526
+ config[:azure_vm_name]
527
527
  end
528
528
  end
529
529
  end