kitchen-vra 3.3.0 → 3.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f27173f48addd541a3b46e530123bf9a5860d196d9b29e6a6e2a32f2df46de2
4
- data.tar.gz: 6d39ffccc15bc8ffdb6b924ba5bfd898bad4603b7e2b13b8687978f22292f957
3
+ metadata.gz: 17c5b9a3f8bcfc3b3379c27f41ebf221245f145752cc14d0c4eb6a811a7e8c8a
4
+ data.tar.gz: 9484530af696bbf2045bc4197d9e216a02ef6f022d7ad2e6f1b1baa39a50d47a
5
5
  SHA512:
6
- metadata.gz: cfc73043b2fc6bcccf21194568782e1195d4ad3dc4859022c409231e2234c21a6cda61fa2d27487c7136fb30dc7363a424aa8edcc0d0a603e699d531f559bd3c
7
- data.tar.gz: 133feaf18a36b1a5f1846b7fcc1f10d0c1b2ab59070fca23770b69de4641eedd0ad552cd96062f536c2787f6aa5bf91d740b7191e89829f27c3dfcaa410a614d
6
+ metadata.gz: 7ff58b2eaad6c83cff51a0bf5d6072424d4e6e21bbdf4f3e12cb20024222b8f5f9f45351db15e39b798f9fb549d5b2cd5e3546d51d36f9fb84ebb9b83709db8c
7
+ data.tar.gz: 6dbe6294fa6a2973932e4960b45fb738771c013ecb89a9f2cbbd30a3f7f3c379158e2ef70604b980db284f3580e8a01014b93190ffe0fa0bf27f35bae1da1cee
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## [v3.3.2](https://github.com/chef-partners/kitchen-vra/tree/v3.3.2)
4
+
5
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.3.1...v3.3.2)
6
+
7
+ - This change helps in getting unique name of a deployment. The new deployement name will be deployment_deploymentId. We need to pass **unique_name** as true(unique_name: true) in the driver configuration.
8
+
9
+ ## [v3.3.1](https://github.com/chef-partners/kitchen-vra/tree/v3.3.1)
10
+
11
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.3.0...v3.3.1)
12
+
13
+ - Fixed the issue with catalog lookup using catalog_name config [\#61](https://github.com/chef-partners/kitchen-vra/pull/61) ([ashiqueps](https://github.com/ashiqueps))
14
+
3
15
  ## [v3.3.0](https://github.com/chef-partners/kitchen-vra/tree/v3.3.0)
4
16
 
5
17
  [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.2.1...v3.3.0)
data/kitchen-vra.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency "test-kitchen"
25
25
  spec.add_dependency "vmware-vra", "~> 3.0", ">= 3.2.0" # 3.0 required for vRA 8.x
26
26
  spec.add_dependency "highline"
27
- spec.add_dependency "rack", ">= 1.6", "< 3.0"
27
+ spec.add_dependency "rack", ">= 1.6", "< 4.0"
28
28
  spec.add_dependency "ffi-yajl", ">= 2.2.3", "< 2.5.0"
29
29
  spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.2"
@@ -45,12 +45,11 @@ module Kitchen
45
45
  default_config :catalog_id, nil
46
46
  default_config :catalog_name, nil
47
47
 
48
- default_config :subtenant_id, nil
49
- default_config :subtenant_name, nil
50
48
  default_config :verify_ssl, true
51
49
  default_config :request_timeout, 600
52
50
  default_config :request_refresh_rate, 2
53
51
  default_config :server_ready_retries, 1
52
+ default_config :unique_name, false
54
53
  default_config :deployment_name do |driver|
55
54
  driver&.instance&.platform&.name
56
55
  end
@@ -154,6 +153,9 @@ module Kitchen
154
153
  deployment_request = catalog_request.submit
155
154
 
156
155
  info("Catalog request #{deployment_request.id} submitted.")
156
+ if config[:unique_name]
157
+ info("Deployment name is deployment_#{deployment_request.id}")
158
+ end
157
159
 
158
160
  wait_for_request(deployment_request)
159
161
  raise "The vRA request failed: #{deployment_request.completion_details}" if deployment_request.failed?
@@ -218,37 +220,30 @@ module Kitchen
218
220
  def catalog_request # rubocop:disable Metrics/MethodLength
219
221
  unless config[:catalog_name].nil?
220
222
  info("Fetching Catalog ID by Catalog Name")
221
- response = vra_client.catalog.fetch_catalog_items(config[:catalog_name])
222
- parsed_json = JSON.parse(response.body)
223
+ catalog_items = vra_client.catalog.fetch_catalog_items(config[:catalog_name])
223
224
  begin
224
- config[:catalog_id] = parsed_json["content"][0]["catalogItemId"]
225
+ config[:catalog_id] = catalog_items[0].id
226
+ info("Using Catalog with ID: #{catalog_items[0].id}")
225
227
  rescue
226
- puts "Unable to retrieve Catalog ID from Catalog Name: #{config[:catalog_name]}"
228
+ error("Unable to retrieve Catalog ID from Catalog Name: #{config[:catalog_name]}")
227
229
  end
228
230
  end
229
231
 
232
+ if config[:catalog_id].nil?
233
+ raise Kitchen::InstanceFailure, "Unable to create deployment without a valid catalog"
234
+ end
235
+
230
236
  deployment_params = {
231
237
  image_mapping: config[:image_mapping],
232
238
  flavor_mapping: config[:flavor_mapping],
233
- name: config[:deployment_name],
234
239
  project_id: config[:project_id],
235
240
  version: config[:version],
236
- }
241
+ }.tap do |h|
242
+ h[:name] = config[:deployment_name] unless config[:unique_name]
243
+ end
237
244
 
238
245
  catalog_request = vra_client.catalog.request(config[:catalog_id], deployment_params)
239
246
 
240
- unless config[:subtenant_name].nil?
241
- info("Fetching Subtenant ID by Subtenant Name")
242
- response = vra_client.fetch_subtenant_items(config[:tenant], config[:subtenant_name])
243
- parsed_json = JSON.parse(response.body)
244
- begin
245
- config[:subtenant_id] = parsed_json["content"][0]["id"]
246
- rescue
247
- puts "Unable to retrieve Subtenant ID from Subtenant Name: #{config[:subtenant_name]}"
248
- end
249
- end
250
- catalog_request.subtenant_id = config[:subtenant_id] unless config[:subtenant_id].nil?
251
-
252
247
  config[:extra_parameters].each do |key, value_data|
253
248
  catalog_request.set_parameters(key, value_data)
254
249
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Kitchen
22
22
  module Driver
23
- VRA_VERSION = "3.3.0"
23
+ VRA_VERSION = "3.3.2"
24
24
  end
25
25
  end
data/spec/vra_spec.rb CHANGED
@@ -41,9 +41,9 @@ describe Kitchen::Driver::Vra do
41
41
  image_mapping: "VRA-nc-lnx-ce8.4-Docker",
42
42
  flavor_mapping: "Small",
43
43
  verify_ssl: true,
44
- subtenant_id: "160b473a-0ec9-473d-8156-28dd96c0b6b7",
45
44
  use_dns: false,
46
45
  deployment_name: "test-instance",
46
+ catalog_id: "1536b95d-68fe-3c68-9417-46ed24bee3ef",
47
47
  }
48
48
  end
49
49
 
@@ -399,7 +399,7 @@ describe Kitchen::Driver::Vra do
399
399
  allow(driver).to receive(:vra_client).and_return(vra_client)
400
400
  allow(vra_client).to receive(:catalog).and_return(catalog)
401
401
  allow(catalog).to receive(:request).and_return(catalog_request)
402
- %i{subtenant_id= set_parameter}.each do |method|
402
+ %i{catalog_id= set_parameter}.each do |method|
403
403
  allow(catalog_request).to receive(method)
404
404
  end
405
405
  end
@@ -420,11 +420,12 @@ describe Kitchen::Driver::Vra do
420
420
  project_id: "6ba69375-79d5-42c3-a099-7d32739f71a7",
421
421
  image_mapping: "VRA-nc-lnx-ce8.4-Docker",
422
422
  flavor_mapping: "Small",
423
+ catalog_id: "2kabc423-af89-56fc-990a-82fab34ed12",
423
424
  }
424
425
  end
425
426
 
426
427
  it "does not attempt to set params on the catalog_request" do
427
- expect(catalog_request).not_to receive(:subtenant_id=)
428
+ expect(catalog_request).not_to receive(:set_parameters)
428
429
  driver.catalog_request
429
430
  end
430
431
  end
@@ -440,6 +441,7 @@ describe Kitchen::Driver::Vra do
440
441
  project_id: "6ba69375-79d5-42c3-a099-7d32739f71a7",
441
442
  image_mapping: "VRA-nc-lnx-ce8.4-Docker",
442
443
  flavor_mapping: "Small",
444
+ catalog_id: "2kabc423-af89-56fc-990a-82fab34ed12",
443
445
  extra_parameters: { "key1" => { type: "string", value: "value1" },
444
446
  "key2" => { type: "integer", value: 123 } },
445
447
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-vra
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Commmunity Tools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-20 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '1.6'
68
68
  - - "<"
69
69
  - !ruby/object:Gem::Version
70
- version: '3.0'
70
+ version: '4.0'
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '1.6'
78
78
  - - "<"
79
79
  - !ruby/object:Gem::Version
80
- version: '3.0'
80
+ version: '4.0'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: ffi-yajl
83
83
  requirement: !ruby/object:Gem::Requirement