kitchen-vra 2.1.0 → 2.7.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
- SHA1:
3
- metadata.gz: d970c0fc31cd5c31e9a8f58730685566ddd6966e
4
- data.tar.gz: 37afb04eae13147372daab1b369384b488eb8501
2
+ SHA256:
3
+ metadata.gz: e26fd3e9f2467163cb766f196eb7691059c12084f259b285f2bc709a591c273a
4
+ data.tar.gz: f263e07c9667b4d171fc61d83ebe177d81200e31aef472e9ca2a83cf2be90f0a
5
5
  SHA512:
6
- metadata.gz: f3e138de6690364ba22d75ec989a64e50c7544dc6c62333369c55c61f0adc8928679761a770c06c85a72e9dc68a6b2a967cd37c1af9777b49be01c721548efa4
7
- data.tar.gz: e5d69ab680453bbcdff3ceb63f8cb9c06dde78b851afb3a87549dd153781d1377980d230dc14671366f2a6e9ae0f74a42c2e1ecd62c25e8fedf1b7ba2606c997
6
+ metadata.gz: 3f316b3afac08b092c47bec00d79458bae0a88013384639391e3a1ab6383aecab5e382869b6e2292fe3a094bfd4ead9a1246d8ef2f05274c26170ba09ed8ed55
7
+ data.tar.gz: 7d1bb7739fa994331a0643ebc8339dda2184fe25b0dee621e259078221679ec417b392f825eda37320df8cf64838fc228ceb90b55290865bcd28f592cea5291a
@@ -0,0 +1,23 @@
1
+ ### Versions:
2
+ <!--- Version of the software where you are encountering the issue --->
3
+ <!-- You should probably update in this is not newest release.--->
4
+ * Version of kitchen-vra:
5
+ * Version of test-kitchen:
6
+ * Version of chef:
7
+
8
+ ### Platform Details
9
+ <!--- What version of vRA are you running? What version of ESXi are you using too?--->
10
+ * Version of vRA:
11
+ * Version of ESXi:
12
+
13
+ ### Scenario:
14
+ <!--- What you are trying to achieve and you can't?--->
15
+
16
+ ### Steps to Reproduce:
17
+ <!--- If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this gem or any resources it includes?--->
18
+
19
+ ### Expected Result:
20
+ <!--- What are you expecting to happen as the consequence of above reproduction steps?--->
21
+
22
+ ### Actual Result:
23
+ <!--- What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.--->
@@ -0,0 +1,14 @@
1
+ ### Description
2
+
3
+ <!--- Describe what this change achieves--->
4
+
5
+ ### Issues Resolved
6
+
7
+ <!--- List any existing issues this PR resolves--->
8
+
9
+ ### Check List
10
+
11
+ - [ ] All tests pass.
12
+ - [ ] All style checks pass.
13
+ - [ ] Functionality includes testing.
14
+ - [ ] Functionality has been documented in the README if applicable
@@ -1,19 +1,32 @@
1
1
  AllCops:
2
2
  DisplayCopNames: true
3
3
  Metrics/AbcSize:
4
- Max: 50
4
+ Max: 100
5
5
  Metrics/ClassLength:
6
6
  Max: 125
7
+ Metrics/CyclomaticComplexity:
8
+ Max: 20
9
+ Metrics/MethodLength:
10
+ Exclude:
11
+ - '**/*.rb'
12
+ Enabled: false
13
+ Metrics/PerceivedComplexity:
14
+ Max: 30
7
15
  Metrics/LineLength:
8
- Max: 130
16
+ Max: 200
9
17
  Metrics/MethodLength:
10
18
  Max: 25
11
19
  Style/Documentation:
12
20
  Enabled: false
21
+ Style/EndOfLine:
22
+ EnforcedStyle: lf
13
23
  Style/SignalException:
14
24
  Enabled: false
15
- Style/SpaceInsideBrackets:
25
+ Layout/SpaceInsideBrackets:
26
+ Enabled: false
27
+ Style/MutableConstant:
16
28
  Enabled: false
17
29
  Metrics/BlockLength:
18
30
  Exclude:
19
31
  - "**/*_spec.rb"
32
+
@@ -3,13 +3,18 @@ cache: bundler
3
3
  sudo: false
4
4
 
5
5
  rvm:
6
- - 2.1
7
- - 2.2
6
+ - 2.2
7
+ - 2.3.3
8
+ - 2.4.1
8
9
 
9
10
  branches:
10
11
  only:
11
12
  - master
12
13
 
14
+ script:
15
+ - bundle exec rake style
16
+ - bundle exec rake spec
17
+
13
18
  notifications:
14
19
  slack:
15
20
  on_success: change
@@ -1,8 +1,47 @@
1
1
  # Change Log
2
2
 
3
- ## [Unreleased](https://github.com/chef-partners/kitchen-vra/tree/HEAD)
3
+ ## [v2.6.0](https://github.com/chef-partners/kitchen-vra/tree/v2.6.0)
4
4
 
5
- [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.0.0...HEAD)
5
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.5.0...v2.6.0)
6
+
7
+ - Accept shirt size option available in blueprint as input in kitchen.yml
8
+
9
+ ## [v2.5.0](https://github.com/chef-partners/kitchen-vra/tree/v2.5.0)
10
+
11
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.4.0...v2.5.0)
12
+
13
+ **Closed issues:**
14
+
15
+ - Feature Query: Support for Capture Snapshot & Restore Snapshot [\#27](https://github.com/chef-partners/kitchen-vra/issues/27)
16
+
17
+ **Merged pull requests:**
18
+
19
+ - Accept subtenant name as input in kitchen.yml [\#28](https://github.com/chef-partners/kitchen-vra/pull/28) ([vinuphilip](https://github.com/vinuphilip))
20
+
21
+ ## [v2.4.0](https://github.com/chef-partners/kitchen-vra/tree/v2.4.0) (2018-01-22)
22
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.3.0...v2.4.0)
23
+
24
+ **Merged pull requests:**
25
+
26
+ - Kitchen vRA enahancements [\#26](https://github.com/chef-partners/kitchen-vra/pull/26) ([rupeshpatel88](https://github.com/rupeshpatel88))
27
+
28
+ ## [v2.3.0](https://github.com/chef-partners/kitchen-vra/tree/v2.3.0) (2017-07-14)
29
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.2.0...v2.3.0)
30
+
31
+ **Merged pull requests:**
32
+
33
+ - Switched to using set\_parameters [\#24](https://github.com/chef-partners/kitchen-vra/pull/24) ([lloydsmithjr03](https://github.com/lloydsmithjr03))
34
+ - Updates for travis and rubocop [\#23](https://github.com/chef-partners/kitchen-vra/pull/23) ([jjasghar](https://github.com/jjasghar))
35
+
36
+ ## [v2.2.0](https://github.com/chef-partners/kitchen-vra/tree/v2.2.0) (2017-02-15)
37
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.1.0...v2.2.0)
38
+
39
+ **Merged pull requests:**
40
+
41
+ - Vra cache creds [\#16](https://github.com/chef-partners/kitchen-vra/pull/16) ([michaelschlies](https://github.com/michaelschlies))
42
+
43
+ ## [v2.1.0](https://github.com/chef-partners/kitchen-vra/tree/v2.1.0) (2017-02-13)
44
+ [Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.0.0...v2.1.0)
6
45
 
7
46
  **Closed issues:**
8
47
 
@@ -68,4 +107,4 @@
68
107
 
69
108
 
70
109
 
71
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
110
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
  gemspec
data/README.md CHANGED
@@ -36,7 +36,22 @@ driver:
36
36
  verify_ssl: true
37
37
  ```
38
38
 
39
- Then configure your platforms. A catalog_id is required for each platform:
39
+ If you want username and password to be prompted, remove usename and password in your .kitchen.yml as shown below:
40
+
41
+ ```yaml
42
+ driver:
43
+ name: vra
44
+ tenant: mytenant
45
+ base_url: https://vra.corp.local
46
+ verify_ssl: true
47
+ ```
48
+ If you don't want to explicitly specify username and password in the kitchen.yml, you have an option to set it in the environment variable as
49
+
50
+ $ export VRA_USER_NAME='myuser@corp.local'
51
+ $ export VRA_USER_PASSWORD='mypassword'
52
+
53
+ Then configure your platforms. Either a catalog_id or a catalog_name is required for each platform. If both catalog_id and catalog_name are mentioned in .kitchen.yml then catalog_name would be used to derive the catalog_id and this catalog_id would override the catalog_id being passed in .kitchen.yml. In the below example as can be seen we are using catalog_id for centos6 driver while catalog_name for the centos7 driver just to demonstrate that we can use either of the two.
54
+
40
55
 
41
56
  ```yaml
42
57
  platforms:
@@ -45,9 +60,11 @@ platforms:
45
60
  catalog_id: e9db1084-d1c6-4c1f-8e3c-eb8f3dc574f9
46
61
  - name: centos7
47
62
  driver:
48
- catalog_id: c4211950-ab07-42b1-ba80-8f5d3f2c8251
63
+ catalog_name: my_catalog_name
49
64
  ```
50
65
 
66
+
67
+
51
68
  Other options that you can set include:
52
69
 
53
70
  * **lease_days**: number of days to request for a lease, if your catalog item / blueprint requires it
@@ -55,12 +72,14 @@ Other options that you can set include:
55
72
  * **server_ready_retries**: Number of times to retry the "waiting for server to be ready" check. In some cases, this will error out immediately due to DNS propagation issues, etc. Setting this to a number greater than 0 will retry the `wait_until_ready` method with a growing sleep in between each attempt. Defaults to 1. Set to 0 to disable any retrying of the `wait_until_ready` method.
56
73
  * **cpus**: number of CPUs the host should have
57
74
  * **memory**: amount of RAM, in MB, the host should have
75
+ * **shirt_size**: This parameter corresponds to shirt size option of vRA available on blueprint like ValueSet.Large, ValueSet.Small etc. As shirt size is a combination of memory and RAM, hence while using this no need to use cpus and memory parameter. This shirt size option helps in standardizing the sizing available for end users
58
76
  * **requested_for**: the vRA login ID to list as the owner of this resource. Defaults to the vRA username configured in the `driver` section.
59
77
  * **subtenant_id**: the Business Group ID to list as the owner. This is required if the catalog item is a shared/global item; we are unable to determine the subtenant_id from the catalog, and vRA requires it to be set on every request.
78
+ * **subtenant_name**: the Business Group Name as the owner. This can be passed instead of subtenant_id and would act as a more friendly name. subtenant_id would be internally retrieved based on the provided subtenant_name. In case both subtenant_id and subtenant_name are passed, subtenant_name would take the precendence and would try to retrieve subtenant_id based on subtenant_name passed.
60
79
  * **private_key_path**: path to the SSH private key to use when logging in. Defaults to '~/.ssh/id_rsa' or '~/.ssh/id_dsa', preferring the RSA key. Only applies to instances where SSH transport is used; i.e., does not apply to Windows hosts with the WinRM transport configured.
61
80
  * **use_dns**: Defaults to `false`. Set to `true` if vRA doesn't manage vm ip addresses. This will cause kitchen to attempt to connect via hostname.
62
81
  * **dns_suffix**: Defaults to `nil`. Set to your domain suffix, for example 'mydomain.com'. This only takes effect when `use_dns` == true and is appended to the hostname returned by vRA.
63
- * **extra_parameters**: a hash of other data to set on a catalog request, most notably custom properties. Allows updates to existing properties on the blueprint as well as the addition of new properties. The vRA REST API expects 'provider-' appended to the front of a property name; each key in the hash is the property name, and the value is a another hash containing the value data type and the value itself.
82
+ * **extra_parameters**: a hash of other data to set on a catalog request, most notably custom properties. Allows updates to existing properties on the blueprint as well as the addition of new properties. Each key in the hash is the property name, and the value is a another hash containing the value data type and the value itself. It is possible to use a `~` to add nested parameters.
64
83
 
65
84
  These settings can be set globally under the top-level `driver` section, or they can be set on each platform, which allows you to set globals and then override them. For example, this configuration would set the CPU count to 1 except on the "large" platform:
66
85
 
@@ -72,23 +91,26 @@ driver:
72
91
  platforms:
73
92
  - name: small
74
93
  driver:
94
+ catalog_name: my_catalog_name_small
75
95
  catalog_id: 8a189191-fea6-43eb-981e-ee0fa40f8f57
76
96
  extra_parameters:
77
- provider-mycustompropname:
97
+ mycustompropname:
78
98
  type: string
79
99
  value: smallvalue
80
- provider-Vrm.DataCenter.Location:
100
+ Vrm.DataCenter.Location:
81
101
  type: string
82
102
  value: Non-Prod
83
103
  - name: large
84
104
  driver:
105
+ catalog_name: my_catalog_name_large
85
106
  catalog_id: 1d7c6122-18fa-4ed6-bd13-8a33b6c6ed50
86
107
  cpus: 2
108
+ subtenant_name: my_subtenant_name
87
109
  extra_parameters:
88
- provider-mycustompropname:
110
+ mycustompropname:
89
111
  type: string
90
112
  value: largevalue
91
- provider-Vrm.DataCenter.Location:
113
+ Vrm.DataCenter.Location:
92
114
  type: string
93
115
  value: Prod
94
116
  ```
@@ -97,7 +119,7 @@ platforms:
97
119
 
98
120
  Author:: Chef Partner Engineering (<partnereng@chef.io>)
99
121
 
100
- Copyright:: Copyright (c) 2015 Chef Software, Inc.
122
+ Copyright:: Copyright (c) 2015-2019 Chef Software, Inc.
101
123
 
102
124
  License:: Apache License, Version 2.0
103
125
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
@@ -5,4 +7,15 @@ require 'rubocop/rake_task'
5
7
  RSpec::Core::RakeTask.new(:spec)
6
8
  RuboCop::RakeTask.new(:style)
7
9
 
8
- task default: [ :spec, :style ]
10
+ begin
11
+ require 'github_changelog_generator/task'
12
+
13
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
14
+ config.future_release = Kitchen::Driver::VRA_VERSION
15
+ config.issues = true
16
+ end
17
+ rescue LoadError
18
+ puts 'github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs'
19
+ end
20
+
21
+ task default: %i[spec style]
@@ -1,4 +1,6 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  lib = File.expand_path('../lib', __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'kitchen/driver/vra_version'
@@ -20,11 +22,14 @@ Gem::Specification.new do |spec|
20
22
 
21
23
  spec.add_dependency 'test-kitchen'
22
24
  spec.add_dependency 'vmware-vra', '~> 2'
23
-
24
- spec.add_development_dependency 'bundler', '~> 1.7'
25
+ spec.add_dependency 'highline'
26
+ spec.add_dependency 'rack', '~> 1.6' unless RUBY_VERSION.index('2.0.').nil?
27
+ spec.add_dependency 'ffi-yajl', '~> 2.2.3' unless RUBY_VERSION.index('2.0.').nil?
28
+ spec.add_development_dependency 'bundler', '>= 1.7'
29
+ spec.add_development_dependency 'github_changelog_generator'
25
30
  spec.add_development_dependency 'rake', '~> 10.0'
26
31
  spec.add_development_dependency 'rspec', '~> 3.2'
27
32
  spec.add_development_dependency 'simplecov', '~> 0.10'
28
33
  spec.add_development_dependency 'webmock', '~> 1.21'
29
- spec.add_development_dependency 'rubocop', '~> 0.35'
34
+ spec.add_development_dependency 'rubocop', '~> 0.49.0'
30
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
3
5
  # Copyright:: Copyright (c) 2015 Chef Software, Inc.
@@ -17,6 +19,10 @@
17
19
  #
18
20
 
19
21
  require 'kitchen'
22
+ require 'highline/import'
23
+ require 'openssl'
24
+ require 'base64'
25
+ require 'digest/sha1'
20
26
  require 'vra'
21
27
  require_relative 'vra_version'
22
28
 
@@ -26,27 +32,31 @@ module Kitchen
26
32
  kitchen_driver_api_version 2
27
33
  plugin_version Kitchen::Driver::VRA_VERSION
28
34
 
29
- required_config :username
30
- required_config :password
35
+ default_config :username, nil
36
+ default_config :password, nil
31
37
  required_config :base_url
32
38
  required_config :tenant
33
- required_config :catalog_id
39
+ default_config :catalog_id, nil
40
+ default_config :catalog_name, nil
34
41
 
35
- default_config :subtenant, nil
42
+ default_config :subtenant_id, nil
43
+ default_config :subtenant_name, nil
36
44
  default_config :verify_ssl, true
37
45
  default_config :request_timeout, 600
38
46
  default_config :request_refresh_rate, 2
39
47
  default_config :server_ready_retries, 1
40
48
  default_config :cpus, 1
41
49
  default_config :memory, 1024
50
+ default_config :shirt_size, nil
42
51
  default_config :requested_for do |driver|
43
52
  driver[:username]
44
53
  end
45
54
  default_config :lease_days, nil
46
55
  default_config :notes, nil
56
+ default_config :cache_credentials, false
47
57
  default_config :extra_parameters, {}
48
58
  default_config :private_key_path do
49
- %w(id_rsa id_dsa).map do |key|
59
+ %w[id_rsa id_dsa].map do |key|
50
60
  file = File.expand_path("~/.ssh/#{key}")
51
61
  file if File.exist?(file)
52
62
  end.compact.first
@@ -58,6 +68,53 @@ module Kitchen
58
68
  'vRA'
59
69
  end
60
70
 
71
+ def check_config(force_change = false)
72
+ config[:username] = config[:username] || ENV['VRA_USER_NAME']
73
+ config[:password] = config[:password] || ENV['VRA_USER_PASSWORD']
74
+ c_load if config[:username].nil? && config[:password].nil?
75
+
76
+ config[:username] = ask('Enter Username: e.g. username@domain') if config[:username].nil? || force_change
77
+ config[:password] = ask('Enter password: ') { |q| q.echo = '*' } if config[:password].nil? || force_change
78
+ c_save if config[:cache_credentials]
79
+ end
80
+
81
+ def c_save
82
+ cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
83
+ cipher.encrypt
84
+ cipher.key = Digest::SHA1.hexdigest(config[:base_url])
85
+ iv_user = cipher.random_iv
86
+ cipher.iv = iv_user
87
+ username = cipher.update(config[:username]) + cipher.final
88
+ iv_pwd = cipher.random_iv
89
+ cipher.iv = iv_pwd
90
+ password = cipher.update(config[:password]) + cipher.final
91
+ output = "#{Base64.encode64(iv_user).strip!}:#{Base64.encode64(username).strip!}:#{Base64.encode64(iv_pwd).strip!}:#{Base64.encode64(password).strip!}"
92
+ file = File.open('.kitchen/cached_vra', 'w')
93
+ file.write(output)
94
+ file.close
95
+ rescue
96
+ puts 'Unable to save credentials'
97
+ end
98
+
99
+ def c_load
100
+ if File.exist? '.kitchen/cached_vra'
101
+ encrypted = File.read('.kitchen/cached_vra')
102
+ iv_user = Base64.decode64(encrypted.split(':')[0] + '\n')
103
+ username = Base64.decode64(encrypted.split(':')[1] + "\n")
104
+ iv_pwd = Base64.decode64(encrypted.split(':')[2] + "\n")
105
+ password = Base64.decode64(encrypted.split(':')[3] + "\n")
106
+ cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
107
+ cipher.decrypt
108
+ cipher.key = Digest::SHA1.hexdigest(config[:base_url])
109
+ cipher.iv = iv_user
110
+ config[:username] = cipher.update(username) + cipher.final
111
+ cipher.iv = iv_pwd
112
+ config[:password] = cipher.update(password) + cipher.final
113
+ end
114
+ rescue
115
+ puts 'Failed to load cached credentials'
116
+ end
117
+
61
118
  def create(state)
62
119
  return if state[:resource_id]
63
120
 
@@ -95,7 +152,7 @@ module Kitchen
95
152
 
96
153
  servers = submitted_request.resources.select(&:vm?)
97
154
  raise 'The vRA request created more than one server. The catalog blueprint should only return one.' if servers.size > 1
98
- raise 'the vRA request did not create any servers.' if servers.empty?
155
+ raise 'the vRA request did not create any servers.' if servers.size.zero?
99
156
 
100
157
  servers.first
101
158
  end
@@ -145,26 +202,53 @@ module Kitchen
145
202
  info("Destroy request #{destroy_request.id} submitted.")
146
203
  wait_for_request(destroy_request)
147
204
  info('Destroy request complete.')
205
+
206
+ File.delete('.kitchen/cached_vra') if File.exist?('.kitchen/cached_vra')
207
+ info('Removed cached file')
148
208
  end
149
209
 
150
- def catalog_request
210
+ def catalog_request # rubocop:disable Metrics/MethodLength
211
+ unless config[:catalog_name].nil?
212
+ info('Fetching Catalog ID by Catalog Name')
213
+ response = vra_client.catalog.fetch_catalog_items(config[:catalog_name])
214
+ parsed_json = JSON.parse(response.body)
215
+ begin
216
+ config[:catalog_id] = parsed_json['content'][0]['catalogItemId']
217
+ rescue
218
+ puts "Unable to retrieve Catalog ID from Catalog Name: #{config[:catalog_name]}"
219
+ end
220
+ end
221
+
151
222
  catalog_request = vra_client.catalog.request(config[:catalog_id])
152
223
 
153
224
  catalog_request.cpus = config[:cpus]
154
225
  catalog_request.memory = config[:memory]
226
+ catalog_request.shirt_size = config[:shirt_size] unless config[:shirt_size].nil?
155
227
  catalog_request.requested_for = config[:requested_for]
156
228
  catalog_request.lease_days = config[:lease_days] unless config[:lease_days].nil?
157
229
  catalog_request.notes = config[:notes] unless config[:notes].nil?
158
- catalog_request.subtenant_id = config[:subtenant_id] unless config[:subtenant_id].nil?
230
+
231
+ unless config[:subtenant_name].nil?
232
+ info('Fetching Subtenant ID by Subtenant Name')
233
+ response = vra_client.fetch_subtenant_items(config[:tenant], config[:subtenant_name])
234
+ parsed_json = JSON.parse(response.body)
235
+ begin
236
+ config[:subtenant_id] = parsed_json['content'][0]['id']
237
+ rescue
238
+ puts "Unable to retrieve Subtenant ID from Subtenant Name: #{config[:subtenant_name]}"
239
+ end
240
+ end
241
+ catalog_request.subtenant_id = config[:subtenant_id] unless config[:subtenant_id].nil?
159
242
 
160
243
  config[:extra_parameters].each do |key, value_data|
161
- catalog_request.set_parameter(key, value_data[:type], value_data[:value])
244
+ catalog_request.set_parameters(key, value_data)
162
245
  end
163
246
 
164
247
  catalog_request
165
248
  end
166
249
 
167
250
  def vra_client
251
+ check_config config[:cache_credentials]
168
252
  @client ||= ::Vra::Client.new(
169
253
  base_url: config[:base_url],
170
254
  username: config[:username],
@@ -172,9 +256,13 @@ module Kitchen
172
256
  tenant: config[:tenant],
173
257
  verify_ssl: config[:verify_ssl]
174
258
  )
259
+ rescue => _e
260
+ check_config true
175
261
  end
176
262
 
177
263
  def wait_for_request(request)
264
+ # config = check_config config
265
+
178
266
  last_status = ''
179
267
  wait_time = config[:request_timeout]
180
268
  sleep_time = config[:request_refresh_rate]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
3
5
  # Copyright:: Copyright (c) 2015 Chef Software, Inc.
@@ -18,6 +20,6 @@
18
20
 
19
21
  module Kitchen
20
22
  module Driver
21
- VRA_VERSION = '2.1.0'.freeze
23
+ VRA_VERSION = '2.7.0'
22
24
  end
23
25
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
3
5
  # Copyright:: Copyright (c) 2015 Chef Software, Inc.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
3
5
  # Copyright:: Copyright (c) 2015 Chef Software, Inc.
@@ -398,7 +400,7 @@ describe Kitchen::Driver::Vra do
398
400
  allow(driver).to receive(:vra_client).and_return(vra_client)
399
401
  allow(vra_client).to receive(:catalog).and_return(catalog)
400
402
  allow(catalog).to receive(:request).and_return(catalog_request)
401
- [ :cpus=, :memory=, :requested_for=, :lease_days=, :notes=, :subtenant_id=, :set_parameter ].each do |method|
403
+ %i[cpus= memory= requested_for= lease_days= notes= subtenant_id= set_parameter].each do |method|
402
404
  allow(catalog_request).to receive(method)
403
405
  end
404
406
  end
@@ -456,8 +458,8 @@ describe Kitchen::Driver::Vra do
456
458
  end
457
459
 
458
460
  it 'sets extra parmeters' do
459
- expect(catalog_request).to receive(:set_parameter).with('key1', 'string', 'value1')
460
- expect(catalog_request).to receive(:set_parameter).with('key2', 'integer', 123)
461
+ expect(catalog_request).to receive(:set_parameters).with('key1', type: 'string', value: 'value1')
462
+ expect(catalog_request).to receive(:set_parameters).with('key2', type: 'integer', value: 123)
461
463
  driver.catalog_request
462
464
  end
463
465
  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: 2.1.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Partner Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-13 00:00:00.000000000 Z
11
+ date: 2020-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -38,20 +38,48 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: highline
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: '1.7'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - "~>"
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: github_changelog_generator
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rake
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +142,14 @@ dependencies:
114
142
  requirements:
115
143
  - - "~>"
116
144
  - !ruby/object:Gem::Version
117
- version: '0.35'
145
+ version: 0.49.0
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
- version: '0.35'
152
+ version: 0.49.0
125
153
  description: A Test Kitchen driver for VMware vRealize Automation (vRA)
126
154
  email:
127
155
  - partnereng@chef.io
@@ -129,6 +157,8 @@ executables: []
129
157
  extensions: []
130
158
  extra_rdoc_files: []
131
159
  files:
160
+ - ".github/ISSUE_TEMPLATE.md"
161
+ - ".github/PULL_REQUEST_TEMPLATE.md"
132
162
  - ".gitignore"
133
163
  - ".rubocop.yml"
134
164
  - ".travis.yml"
@@ -161,8 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
191
  - !ruby/object:Gem::Version
162
192
  version: '0'
163
193
  requirements: []
164
- rubyforge_project:
165
- rubygems_version: 2.5.1
194
+ rubygems_version: 3.1.2
166
195
  signing_key:
167
196
  specification_version: 4
168
197
  summary: A Test Kitchen driver for VMware vRealize Automation (vRA)