kitchen-vra 3.3.0 → 3.3.1

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: 91e7615f23a44ae83327415c6648fdc8b3950c56ff18f0aab216ed19a7902a00
4
+ data.tar.gz: 8266b22c55a1f4d0d63d50b16be20fd6765fcf3cc92f4c3f4730bf70a5ab289f
5
5
  SHA512:
6
- metadata.gz: cfc73043b2fc6bcccf21194568782e1195d4ad3dc4859022c409231e2234c21a6cda61fa2d27487c7136fb30dc7363a424aa8edcc0d0a603e699d531f559bd3c
7
- data.tar.gz: 133feaf18a36b1a5f1846b7fcc1f10d0c1b2ab59070fca23770b69de4641eedd0ad552cd96062f536c2787f6aa5bf91d740b7191e89829f27c3dfcaa410a614d
6
+ metadata.gz: 8c5ae9e75bef239d5c4751100aa5a5c4c30cf135a4ed24831e2ee522d46ce5ce6090e86cf7fb7bd2a13df8968a93d0b2924c9caee7812c2340a75bfa8b6e94d2
7
+ data.tar.gz: 3772f71069fa0f70095925a1008b728d40d91a27a6248b39e5ec1684d6849b4556cf75ca553e57f681829b01a23ee86084b084f4dde4c2f5d8d245132c1a5d5f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## [v3.3.1](https://github.com/chef-partners/kitchen-vra/tree/v3.3.1)
4
+
5
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.3.0...v3.3.1)
6
+
7
+ - 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))
8
+
3
9
  ## [v3.3.0](https://github.com/chef-partners/kitchen-vra/tree/v3.3.0)
4
10
 
5
11
  [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.2.1...v3.3.0)
@@ -45,8 +45,6 @@ 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
@@ -218,15 +216,19 @@ module Kitchen
218
216
  def catalog_request # rubocop:disable Metrics/MethodLength
219
217
  unless config[:catalog_name].nil?
220
218
  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)
219
+ catalog_items = vra_client.catalog.fetch_catalog_items(config[:catalog_name])
223
220
  begin
224
- config[:catalog_id] = parsed_json["content"][0]["catalogItemId"]
221
+ config[:catalog_id] = catalog_items[0].id
222
+ info("Using Catalog with ID: #{catalog_items[0].id}")
225
223
  rescue
226
- puts "Unable to retrieve Catalog ID from Catalog Name: #{config[:catalog_name]}"
224
+ error("Unable to retrieve Catalog ID from Catalog Name: #{config[:catalog_name]}")
227
225
  end
228
226
  end
229
227
 
228
+ if config[:catalog_id].nil?
229
+ raise Kitchen::InstanceFailure, "Unable to create deployment without a valid catalog"
230
+ end
231
+
230
232
  deployment_params = {
231
233
  image_mapping: config[:image_mapping],
232
234
  flavor_mapping: config[:flavor_mapping],
@@ -237,18 +239,6 @@ module Kitchen
237
239
 
238
240
  catalog_request = vra_client.catalog.request(config[:catalog_id], deployment_params)
239
241
 
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
242
  config[:extra_parameters].each do |key, value_data|
253
243
  catalog_request.set_parameters(key, value_data)
254
244
  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.1"
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.1
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-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen