kitchen-azurerm 1.10.5 → 1.12.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
  SHA256:
3
- metadata.gz: 8c2d4d855c70865164332265323c12695861be5a81ba70d16c080e0b3d123e82
4
- data.tar.gz: d7da5dc49a5b7c0edf83f106fac5a972501488e3846625e3c5014ae5b3dd9c72
3
+ metadata.gz: 307c89905dfa66472753bbb6e2be46a63a8633a4b22cc9b94558a681ce8a9394
4
+ data.tar.gz: 79b0a3ef96c911c209179515950232b7bfb14b2971b32f11b1f3f644dd734178
5
5
  SHA512:
6
- metadata.gz: 8d0fca11da2c12b66d0c44f9a976b5cb0124be9358db6bb7f4d61f408ca66d52bf94be4cb38250c5f81e1a41ccc44cdeaf7a3f7d8ad9ef860f5aaa59e09f5be2
7
- data.tar.gz: 966578a9f01c4ff89aa86a91b9ad313c16c9804d9c42a2fbef966e0abf434f907f0b976f5f73b3e2bf09fb15b4343c7b330f56471a5082e16609f4bc546ea5f1
6
+ metadata.gz: 6df983570c0d3ac89af2ae62ad68dce8ddbbe09fc535b119b8e758d0c8af177cfa140917b8926fb70cdf124cd466d6de65fa81b14a47c2b47fc1511d6a1cc25a
7
+ data.tar.gz: 0007aaa232ebfa119aff88eeafffc07b229aca5088e034312042799a29ab74bac6bb7ff9c8a1be2dae95b6ab25c74a5487427278ba543600874ab3a66f1df9f2
@@ -1,6 +1,8 @@
1
1
  require "inifile"
2
+
2
3
  require "kitchen/logging"
3
- autoload :MsRest, "ms_rest"
4
+ autoload :MsRest2, "ms_rest2"
5
+ autoload :MsRestAzure2, "ms_rest_azure2"
4
6
 
5
7
  module Kitchen
6
8
  module Driver
@@ -38,7 +40,7 @@ module Kitchen
38
40
  def azure_options
39
41
  options = { tenant_id: tenant_id!,
40
42
  subscription_id: subscription_id,
41
- credentials: ::MsRest::TokenCredentials.new(token_provider),
43
+ credentials: ::MsRest2::TokenCredentials.new(token_provider),
42
44
  active_directory_settings: ad_settings,
43
45
  base_url: endpoint_settings.resource_manager_endpoint_url }
44
46
  options[:client_id] = client_id if client_id
@@ -87,7 +89,7 @@ module Kitchen
87
89
 
88
90
  # Retrieve a token based upon the preferred authentication method.
89
91
  #
90
- # @return [::MsRest::TokenProvider] A new token provider object.
92
+ # @return [::MsRest2::TokenProvider] A new token provider object.
91
93
  def token_provider
92
94
  # Login with a credentials file or setting the environment variables
93
95
  #
@@ -95,63 +97,63 @@ module Kitchen
95
97
  #
96
98
  # SPN with client_id, client_secret and tenant_id
97
99
  if client_id && client_secret && tenant_id
98
- ::MsRestAzure::ApplicationTokenProvider.new(tenant_id, client_id, client_secret, ad_settings)
100
+ ::MsRestAzure2::ApplicationTokenProvider.new(tenant_id, client_id, client_secret, ad_settings)
99
101
  # Login with a Managed Service Identity.
100
102
  #
101
103
  # Typically used with a Managed Service Identity when you have a particular object registered in a tenant.
102
104
  #
103
105
  # MSI with client_id and tenant_id (aka User Assigned Identity).
104
106
  elsif client_id && tenant_id
105
- ::MsRestAzure::MSITokenProvider.new(50342, ad_settings, { client_id: client_id })
107
+ ::MsRestAzure2::MSITokenProvider.new(50342, ad_settings, { client_id: client_id })
106
108
  # Default approach to inheriting existing object permissions (application or device this code is running on).
107
109
  #
108
110
  # Typically used when you want to inherit the permissions of the system you're running on that are in a tenant.
109
111
  #
110
112
  # MSI with just tenant_id (aka System Assigned Identity).
111
113
  elsif tenant_id
112
- ::MsRestAzure::MSITokenProvider.new(50342, ad_settings)
114
+ ::MsRestAzure2::MSITokenProvider.new(50342, ad_settings)
113
115
  # Login using the Azure CLI
114
116
  #
115
117
  # Typically used when you want to rely upon `az login` as your preferred authentication method.
116
118
  else
117
119
  warn("Using tenant id set through `az login`.")
118
- ::MsRestAzure::AzureCliTokenProvider.new(ad_settings)
120
+ ::MsRestAzure2::AzureCliTokenProvider.new(ad_settings)
119
121
  end
120
122
  end
121
123
 
122
124
  #
123
- # Retrieves a [MsRestAzure::ActiveDirectoryServiceSettings] object representing the AD settings for the given cloud.
125
+ # Retrieves a [MsRestAzure2::ActiveDirectoryServiceSettings] object representing the AD settings for the given cloud.
124
126
  #
125
- # @return [MsRestAzure::ActiveDirectoryServiceSettings] Settings to be used for subsequent requests
127
+ # @return [MsRestAzure2::ActiveDirectoryServiceSettings] Settings to be used for subsequent requests
126
128
  #
127
129
  def ad_settings
128
130
  case environment.downcase
129
131
  when "azureusgovernment"
130
- ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_us_government_settings
132
+ ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_us_government_settings
131
133
  when "azurechina"
132
- ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_china_settings
134
+ ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_china_settings
133
135
  when "azuregermancloud"
134
- ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_german_settings
136
+ ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_german_settings
135
137
  when "azure"
136
- ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings
138
+ ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_settings
137
139
  end
138
140
  end
139
141
 
140
142
  #
141
- # Retrieves a [MsRestAzure::AzureEnvironment] object representing endpoint settings for the given cloud.
143
+ # Retrieves a [MsRestAzure2::AzureEnvironment] object representing endpoint settings for the given cloud.
142
144
  #
143
- # @return [MsRestAzure::AzureEnvironment] Settings to be used for subsequent requests
145
+ # @return [MsRestAzure2::AzureEnvironment] Settings to be used for subsequent requests
144
146
  #
145
147
  def endpoint_settings
146
148
  case environment.downcase
147
149
  when "azureusgovernment"
148
- ::MsRestAzure::AzureEnvironments::AzureUSGovernment
150
+ ::MsRestAzure2::AzureEnvironments::AzureUSGovernment
149
151
  when "azurechina"
150
- ::MsRestAzure::AzureEnvironments::AzureChinaCloud
152
+ ::MsRestAzure2::AzureEnvironments::AzureChinaCloud
151
153
  when "azuregermancloud"
152
- ::MsRestAzure::AzureEnvironments::AzureGermanCloud
154
+ ::MsRestAzure2::AzureEnvironments::AzureGermanCloud
153
155
  when "azure"
154
- ::MsRestAzure::AzureEnvironments::AzureCloud
156
+ ::MsRestAzure2::AzureEnvironments::AzureCloud
155
157
  end
156
158
  end
157
159
  end
@@ -1,11 +1,11 @@
1
1
  require "kitchen"
2
2
 
3
- autoload :MsRestAzure, "ms_rest_azure"
3
+ autoload :MsRestAzure2, "ms_rest_azure2"
4
4
  require_relative "azure_credentials"
5
5
  require "securerandom" unless defined?(SecureRandom)
6
6
  module Azure
7
- autoload :Resources, "azure_mgmt_resources"
8
- autoload :Network, "azure_mgmt_network"
7
+ autoload :Resources2, "azure_mgmt_resources2"
8
+ autoload :Network2, "azure_mgmt_network2"
9
9
  end
10
10
  require "base64" unless defined?(Base64)
11
11
  autoload :SSHKey, "sshkey"
@@ -21,7 +21,7 @@ module Kitchen
21
21
  # Azurerm
22
22
  # Create a new resource group object and set the location and tags attributes then return it.
23
23
  #
24
- # @return [::Azure::Resources::Profiles::Latest::Mgmt::Models::ResourceGroup] A new resource group object.
24
+ # @return [::Azure::Resources2::Profiles::Latest::Mgmt::Models::ResourceGroup] A new resource group object.
25
25
  class Azurerm < Kitchen::Driver::Base
26
26
  attr_accessor :resource_management_client
27
27
  attr_accessor :network_management_client
@@ -298,13 +298,13 @@ module Kitchen
298
298
  environment: config[:azure_environment]).azure_options
299
299
 
300
300
  debug "Azure environment: #{config[:azure_environment]}"
301
- @resource_management_client = ::Azure::Resources::Profiles::Latest::Mgmt::Client.new(options)
301
+ @resource_management_client = ::Azure::Resources2::Profiles::Latest::Mgmt::Client.new(options)
302
302
 
303
303
  # Create Resource Group
304
304
  begin
305
305
  info "Creating Resource Group: #{state[:azure_resource_group_name]}"
306
306
  create_resource_group(state[:azure_resource_group_name], get_resource_group)
307
- rescue ::MsRestAzure::AzureOperationError => operation_error
307
+ rescue ::MsRestAzure2::AzureOperationError => operation_error
308
308
  error operation_error.body
309
309
  raise operation_error
310
310
  end
@@ -333,7 +333,7 @@ module Kitchen
333
333
  create_deployment_async(state[:azure_resource_group_name], post_deployment_name, post_deployment(config[:post_deployment_template], config[:post_deployment_parameters])).value!
334
334
  follow_deployment_until_end_state(state[:azure_resource_group_name], post_deployment_name)
335
335
  end
336
- rescue ::MsRestAzure::AzureOperationError => operation_error
336
+ rescue ::MsRestAzure2::AzureOperationError => operation_error
337
337
  rest_error = operation_error.body["error"]
338
338
  deployment_active = rest_error["code"] == "DeploymentActive"
339
339
  if deployment_active
@@ -345,7 +345,7 @@ module Kitchen
345
345
  end
346
346
  end
347
347
 
348
- @network_management_client = ::Azure::Network::Profiles::Latest::Mgmt::Client.new(options)
348
+ @network_management_client = ::Azure::Network2::Profiles::Latest::Mgmt::Client.new(options)
349
349
 
350
350
  if config[:vnet_id] == "" || config[:public_ip]
351
351
  # Retrieve the public IP from the resource group:
@@ -464,9 +464,9 @@ module Kitchen
464
464
 
465
465
  def pre_deployment(pre_deployment_template_filename, pre_deployment_parameters)
466
466
  pre_deployment_template = ::File.read(pre_deployment_template_filename)
467
- pre_deployment = ::Azure::Resources::Profiles::Latest::Mgmt::Models::Deployment.new
468
- pre_deployment.properties = ::Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentProperties.new
469
- pre_deployment.properties.mode = ::Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental
467
+ pre_deployment = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::Deployment.new
468
+ pre_deployment.properties = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::DeploymentProperties.new
469
+ pre_deployment.properties.mode = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental
470
470
  pre_deployment.properties.template = JSON.parse(pre_deployment_template)
471
471
  pre_deployment.properties.parameters = parameters_in_values_format(pre_deployment_parameters)
472
472
  debug(pre_deployment.properties.template)
@@ -475,9 +475,9 @@ module Kitchen
475
475
 
476
476
  def deployment(parameters)
477
477
  template = template_for_transport_name
478
- deployment = ::Azure::Resources::Profiles::Latest::Mgmt::Models::Deployment.new
479
- deployment.properties = ::Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentProperties.new
480
- deployment.properties.mode = ::Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental
478
+ deployment = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::Deployment.new
479
+ deployment.properties = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::DeploymentProperties.new
480
+ deployment.properties.mode = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental
481
481
  deployment.properties.template = JSON.parse(template)
482
482
  deployment.properties.parameters = parameters_in_values_format(parameters)
483
483
  debug(JSON.pretty_generate(deployment.properties.template))
@@ -486,9 +486,9 @@ module Kitchen
486
486
 
487
487
  def post_deployment(post_deployment_template_filename, post_deployment_parameters)
488
488
  post_deployment_template = ::File.read(post_deployment_template_filename)
489
- post_deployment = ::Azure::Resources::Profiles::Latest::Mgmt::Models::Deployment.new
490
- post_deployment.properties = ::Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentProperties.new
491
- post_deployment.properties.mode = ::Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental
489
+ post_deployment = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::Deployment.new
490
+ post_deployment.properties = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::DeploymentProperties.new
491
+ post_deployment.properties.mode = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental
492
492
  post_deployment.properties.template = JSON.parse(post_deployment_template)
493
493
  post_deployment.properties.parameters = parameters_in_values_format(post_deployment_parameters)
494
494
  debug(post_deployment.properties.template)
@@ -497,9 +497,9 @@ module Kitchen
497
497
 
498
498
  def empty_deployment
499
499
  template = virtual_machine_deployment_template_file("empty.erb", nil)
500
- empty_deployment = ::Azure::Resources::Profiles::Latest::Mgmt::Models::Deployment.new
501
- empty_deployment.properties = ::Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentProperties.new
502
- empty_deployment.properties.mode = ::Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentMode::Complete
500
+ empty_deployment = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::Deployment.new
501
+ empty_deployment.properties = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::DeploymentProperties.new
502
+ empty_deployment.properties.mode = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::DeploymentMode::Complete
503
503
  empty_deployment.properties.template = JSON.parse(template)
504
504
  debug(JSON.pretty_generate(empty_deployment.properties.template))
505
505
  empty_deployment
@@ -570,7 +570,7 @@ module Kitchen
570
570
  # Setup our authentication components for the SDK
571
571
  options = Kitchen::Driver::AzureCredentials.new(subscription_id: state[:subscription_id],
572
572
  environment: state[:azure_environment]).azure_options
573
- @resource_management_client = ::Azure::Resources::Profiles::Latest::Mgmt::Client.new(options)
573
+ @resource_management_client = ::Azure::Resources2::Profiles::Latest::Mgmt::Client.new(options)
574
574
 
575
575
  # If we don't have any instances, let's check to see if the user wants to delete a resource group and if so let's delete!
576
576
  if state[:server_id].nil? && state[:azure_resource_group_name].nil? && !config[:explicit_resource_group_name].nil? && config[:destroy_explicit_resource_group]
@@ -581,7 +581,7 @@ module Kitchen
581
581
  delete_resource_group_async(config[:explicit_resource_group_name])
582
582
  info "Destroy operation accepted and will continue in the background."
583
583
  return
584
- rescue ::MsRestAzure::AzureOperationError => operation_error
584
+ rescue ::MsRestAzure2::AzureOperationError => operation_error
585
585
  error operation_error.body
586
586
  raise operation_error
587
587
  end
@@ -614,12 +614,12 @@ module Kitchen
614
614
  resource_group.tags = {}
615
615
  create_resource_group(state[:azure_resource_group_name], resource_group) unless config[:destroy_explicit_resource_group_tags] == false
616
616
  warn 'The "destroy_explicit_resource_group_tags" setting value is set to "true". The tags on the resource group will be removed.' unless config[:destroy_explicit_resource_group_tags] == false
617
- rescue ::MsRestAzure::AzureOperationError => operation_error
617
+ rescue ::MsRestAzure2::AzureOperationError => operation_error
618
618
  error operation_error.body
619
619
  raise operation_error
620
620
  end
621
621
 
622
- rescue ::MsRestAzure::AzureOperationError => operation_error
622
+ rescue ::MsRestAzure2::AzureOperationError => operation_error
623
623
  error operation_error.body
624
624
  raise operation_error
625
625
  end
@@ -639,7 +639,7 @@ module Kitchen
639
639
  info "Destroy operation accepted and will continue in the background."
640
640
  # Remove resource group name from driver state
641
641
  state.delete(:azure_resource_group_name)
642
- rescue ::MsRestAzure::AzureOperationError => operation_error
642
+ rescue ::MsRestAzure2::AzureOperationError => operation_error
643
643
  error operation_error.body
644
644
  raise operation_error
645
645
  end
@@ -769,13 +769,13 @@ module Kitchen
769
769
  def resource_manager_endpoint_url(azure_environment)
770
770
  case azure_environment.downcase
771
771
  when "azureusgovernment"
772
- MsRestAzure::AzureEnvironments::AzureUSGovernment.resource_manager_endpoint_url
772
+ MsRestAzure2::AzureEnvironments::AzureUSGovernment.resource_manager_endpoint_url
773
773
  when "azurechina"
774
- MsRestAzure::AzureEnvironments::AzureChinaCloud.resource_manager_endpoint_url
774
+ MsRestAzure2::AzureEnvironments::AzureChinaCloud.resource_manager_endpoint_url
775
775
  when "azuregermancloud"
776
- MsRestAzure::AzureEnvironments::AzureGermanCloud.resource_manager_endpoint_url
776
+ MsRestAzure2::AzureEnvironments::AzureGermanCloud.resource_manager_endpoint_url
777
777
  when "azure"
778
- MsRestAzure::AzureEnvironments::AzureCloud.resource_manager_endpoint_url
778
+ MsRestAzure2::AzureEnvironments::AzureCloud.resource_manager_endpoint_url
779
779
  end
780
780
  end
781
781
 
@@ -798,9 +798,9 @@ module Kitchen
798
798
 
799
799
  # Create a new resource group object and set the location and tags attributes then return it.
800
800
  #
801
- # @return [::Azure::Resources::Profiles::Latest::Mgmt::Models::ResourceGroup] A new resource group object.
801
+ # @return [::Azure::Resources2::Profiles::Latest::Mgmt::Models::ResourceGroup] A new resource group object.
802
802
  def get_resource_group
803
- resource_group = ::Azure::Resources::Profiles::Latest::Mgmt::Models::ResourceGroup.new
803
+ resource_group = ::Azure::Resources2::Profiles::Latest::Mgmt::Models::ResourceGroup.new
804
804
  resource_group.location = config[:location]
805
805
  resource_group.tags = config[:resource_group_tags]
806
806
  resource_group
@@ -868,7 +868,7 @@ module Kitchen
868
868
  def get_network_interface(resource_group_name, network_interface_name)
869
869
  retries = config[:azure_api_retries]
870
870
  begin
871
- network_interfaces = ::Azure::Network::Profiles::Latest::Mgmt::NetworkInterfaces.new(network_management_client)
871
+ network_interfaces = ::Azure::Network2::Profiles::Latest::Mgmt::NetworkInterfaces.new(network_management_client)
872
872
  network_interfaces.get(resource_group_name, network_interface_name)
873
873
  rescue Faraday::TimeoutError, Faraday::ClientError => exception
874
874
  send_exception_message(exception, "while fetching network interface '#{network_interface_name}' for resource group '#{resource_group_name}'. #{retries} retries left.")
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Driver
3
- AZURERM_VERSION = "1.10.5".freeze
3
+ AZURERM_VERSION = "1.12.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-azurerm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.5
4
+ version: 1.12.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: 2022-04-13 00:00:00.000000000 Z
11
+ date: 2023-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: azure_mgmt_network
14
+ name: azure_mgmt_network2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.18'
19
+ version: 1.0.1
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.18.2
22
+ version: 1.0.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.18'
29
+ version: 1.0.1
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.18.2
32
+ version: 1.0.1
33
33
  - !ruby/object:Gem::Dependency
34
- name: azure_mgmt_resources
34
+ name: azure_mgmt_resources2
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.17'
39
+ version: 1.0.1
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.17.2
42
+ version: 1.0.1
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0.17'
49
+ version: 1.0.1
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 0.17.2
52
+ version: 1.0.1
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: inifile
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.3.7
146
+ rubygems_version: 3.3.3
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Test Kitchen driver for Azure Resource Manager.