kitchen-vra 3.2.1 → 3.3.1

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: 763ef43f1f069167f4745436838b49e370deecc12055da82519b7d5249b08317
4
- data.tar.gz: 594985e266bd2389c42efeedb09868f37499e8ee5933980e92989ab7c1e3e845
3
+ metadata.gz: 91e7615f23a44ae83327415c6648fdc8b3950c56ff18f0aab216ed19a7902a00
4
+ data.tar.gz: 8266b22c55a1f4d0d63d50b16be20fd6765fcf3cc92f4c3f4730bf70a5ab289f
5
5
  SHA512:
6
- metadata.gz: 0da0c199033bb8a8e17cca31ae04a6e11a05a49afd9737bb6b70255ed30a4ad1496ef9142cc6ebe447dfed39e8d2c2b7908269aec96e61a19f956ff7d027688f
7
- data.tar.gz: 8c9afb831b2e0e97594a69154f325feea7b968dfd9cafcdd619482015db2bcd2179bbba7e9060873fe7a35723878da3ca810bff4402e2c65df94b8eb34dc3dfd
6
+ metadata.gz: 8c5ae9e75bef239d5c4751100aa5a5c4c30cf135a4ed24831e2ee522d46ce5ce6090e86cf7fb7bd2a13df8968a93d0b2924c9caee7812c2340a75bfa8b6e94d2
7
+ data.tar.gz: 3772f71069fa0f70095925a1008b728d40d91a27a6248b39e5ec1684d6849b4556cf75ca553e57f681829b01a23ee86084b084f4dde4c2f5d8d245132c1a5d5f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+
9
+ ## [v3.3.0](https://github.com/chef-partners/kitchen-vra/tree/v3.3.0)
10
+
11
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.2.1...v3.3.0)
12
+
13
+ - Replaced the tenant attribute with the domain attribute [\#59](https://github.com/chef-partners/kitchen-vra/pull/59) ([ashiqueps](https://github.com/ashiqueps))
14
+
3
15
  ## [v3.2.1](https://github.com/chef-partners/kitchen-vra/tree/v3.2.1)
4
16
 
5
17
  [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.2.0...v3.2.1)
data/kitchen-vra.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.required_ruby_version = ">= 2.7"
23
23
 
24
24
  spec.add_dependency "test-kitchen"
25
- spec.add_dependency "vmware-vra", ">= 3.1.0" # 3.0 required for vRA 8.x
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
27
  spec.add_dependency "rack", ">= 1.6", "< 3.0"
28
28
  spec.add_dependency "ffi-yajl", ">= 2.2.3", "< 2.5.0"
@@ -35,17 +35,16 @@ module Kitchen
35
35
  default_config :username, nil
36
36
  default_config :password, nil
37
37
  required_config :base_url
38
- required_config :tenant
38
+ required_config :domain
39
39
  required_config :project_id
40
40
  required_config :image_mapping
41
41
  required_config :flavor_mapping
42
42
 
43
+ default_config :tenant, nil
43
44
  default_config :version, nil
44
45
  default_config :catalog_id, nil
45
46
  default_config :catalog_name, nil
46
47
 
47
- default_config :subtenant_id, nil
48
- default_config :subtenant_name, nil
49
48
  default_config :verify_ssl, true
50
49
  default_config :request_timeout, 600
51
50
  default_config :request_refresh_rate, 2
@@ -64,6 +63,10 @@ module Kitchen
64
63
  default_config :use_dns, false
65
64
  default_config :dns_suffix, nil
66
65
 
66
+ deprecate_config_for :tenant, Util.outdent!("
67
+ In vRA 8.x, the 'tenant' configuration is no longer relevant for authentication.
68
+ Please use the 'domain' configuration in its place.".dup)
69
+
67
70
  def name
68
71
  "vRA"
69
72
  end
@@ -213,15 +216,19 @@ module Kitchen
213
216
  def catalog_request # rubocop:disable Metrics/MethodLength
214
217
  unless config[:catalog_name].nil?
215
218
  info("Fetching Catalog ID by Catalog Name")
216
- response = vra_client.catalog.fetch_catalog_items(config[:catalog_name])
217
- parsed_json = JSON.parse(response.body)
219
+ catalog_items = vra_client.catalog.fetch_catalog_items(config[:catalog_name])
218
220
  begin
219
- 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}")
220
223
  rescue
221
- 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]}")
222
225
  end
223
226
  end
224
227
 
228
+ if config[:catalog_id].nil?
229
+ raise Kitchen::InstanceFailure, "Unable to create deployment without a valid catalog"
230
+ end
231
+
225
232
  deployment_params = {
226
233
  image_mapping: config[:image_mapping],
227
234
  flavor_mapping: config[:flavor_mapping],
@@ -232,18 +239,6 @@ module Kitchen
232
239
 
233
240
  catalog_request = vra_client.catalog.request(config[:catalog_id], deployment_params)
234
241
 
235
- unless config[:subtenant_name].nil?
236
- info("Fetching Subtenant ID by Subtenant Name")
237
- response = vra_client.fetch_subtenant_items(config[:tenant], config[:subtenant_name])
238
- parsed_json = JSON.parse(response.body)
239
- begin
240
- config[:subtenant_id] = parsed_json["content"][0]["id"]
241
- rescue
242
- puts "Unable to retrieve Subtenant ID from Subtenant Name: #{config[:subtenant_name]}"
243
- end
244
- end
245
- catalog_request.subtenant_id = config[:subtenant_id] unless config[:subtenant_id].nil?
246
-
247
242
  config[:extra_parameters].each do |key, value_data|
248
243
  catalog_request.set_parameters(key, value_data)
249
244
  end
@@ -257,7 +252,7 @@ module Kitchen
257
252
  base_url: config[:base_url],
258
253
  username: config[:username],
259
254
  password: config[:password],
260
- tenant: config[:tenant],
255
+ domain: config[:domain],
261
256
  verify_ssl: config[:verify_ssl]
262
257
  )
263
258
  rescue => _e
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Kitchen
22
22
  module Driver
23
- VRA_VERSION = "3.2.1"
23
+ VRA_VERSION = "3.3.1"
24
24
  end
25
25
  end
data/spec/vra_spec.rb CHANGED
@@ -36,14 +36,14 @@ describe Kitchen::Driver::Vra do
36
36
  base_url: "https://vra.corp.local",
37
37
  username: "myuser",
38
38
  password: "mypassword",
39
- tenant: "mytenant",
39
+ domain: "mytenant.corp.com",
40
40
  project_id: "6ba69375-79d5-42c3-a099-7d32739f71a7",
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
@@ -415,16 +415,17 @@ describe Kitchen::Driver::Vra do
415
415
  base_url: "https://vra.corp.local",
416
416
  username: "myuser",
417
417
  password: "mypassword",
418
- tenant: "mytenant",
418
+ domain: "domain.corp.com",
419
419
  verify_ssl: true,
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
@@ -435,11 +436,12 @@ describe Kitchen::Driver::Vra do
435
436
  base_url: "https://vra.corp.local",
436
437
  username: "myuser",
437
438
  password: "mypassword",
438
- tenant: "mytenant",
439
+ domain: "mydomain.corp.com",
439
440
  verify_ssl: true,
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
  }
@@ -458,7 +460,7 @@ describe Kitchen::Driver::Vra do
458
460
  expect(Vra::Client).to receive(:new).with(base_url: config[:base_url],
459
461
  username: config[:username],
460
462
  password: config[:password],
461
- tenant: config[:tenant],
463
+ domain: config[:domain],
462
464
  verify_ssl: config[:verify_ssl])
463
465
  driver.vra_client
464
466
  end
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.2.1
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-11-02 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
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: vmware-vra
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
31
34
  - - ">="
32
35
  - !ruby/object:Gem::Version
33
- version: 3.1.0
36
+ version: 3.2.0
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '3.0'
38
44
  - - ">="
39
45
  - !ruby/object:Gem::Version
40
- version: 3.1.0
46
+ version: 3.2.0
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: highline
43
49
  requirement: !ruby/object:Gem::Requirement