kitchen-vra 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +16 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/README.md +7 -6
- data/Rakefile +2 -1
- data/kitchen-vra.gemspec +3 -2
- data/lib/kitchen/driver/vra.rb +19 -16
- data/lib/kitchen/driver/vra_version.rb +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/vra_spec.rb +4 -3
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e26fd3e9f2467163cb766f196eb7691059c12084f259b285f2bc709a591c273a
|
4
|
+
data.tar.gz: f263e07c9667b4d171fc61d83ebe177d81200e31aef472e9ca2a83cf2be90f0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f316b3afac08b092c47bec00d79458bae0a88013384639391e3a1ab6383aecab5e382869b6e2292fe3a094bfd4ead9a1246d8ef2f05274c26170ba09ed8ed55
|
7
|
+
data.tar.gz: 7d1bb7739fa994331a0643ebc8339dda2184fe25b0dee621e259078221679ec417b392f825eda37320df8cf64838fc228ceb90b55290865bcd28f592cea5291a
|
data/.rubocop.yml
CHANGED
@@ -1,19 +1,32 @@
|
|
1
1
|
AllCops:
|
2
2
|
DisplayCopNames: true
|
3
3
|
Metrics/AbcSize:
|
4
|
-
Max:
|
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:
|
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
|
-
|
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
|
+
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v2.6.0](https://github.com/chef-partners/kitchen-vra/tree/v2.6.0)
|
4
|
+
|
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
|
+
|
3
9
|
## [v2.5.0](https://github.com/chef-partners/kitchen-vra/tree/v2.5.0)
|
4
10
|
|
5
11
|
[Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.4.0...v2.5.0)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -72,13 +72,14 @@ Other options that you can set include:
|
|
72
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.
|
73
73
|
* **cpus**: number of CPUs the host should have
|
74
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
|
75
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.
|
76
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.
|
77
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.
|
78
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.
|
79
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.
|
80
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.
|
81
|
-
* **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.
|
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.
|
82
83
|
|
83
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:
|
84
85
|
|
@@ -93,10 +94,10 @@ platforms:
|
|
93
94
|
catalog_name: my_catalog_name_small
|
94
95
|
catalog_id: 8a189191-fea6-43eb-981e-ee0fa40f8f57
|
95
96
|
extra_parameters:
|
96
|
-
|
97
|
+
mycustompropname:
|
97
98
|
type: string
|
98
99
|
value: smallvalue
|
99
|
-
|
100
|
+
Vrm.DataCenter.Location:
|
100
101
|
type: string
|
101
102
|
value: Non-Prod
|
102
103
|
- name: large
|
@@ -106,10 +107,10 @@ platforms:
|
|
106
107
|
cpus: 2
|
107
108
|
subtenant_name: my_subtenant_name
|
108
109
|
extra_parameters:
|
109
|
-
|
110
|
+
mycustompropname:
|
110
111
|
type: string
|
111
112
|
value: largevalue
|
112
|
-
|
113
|
+
Vrm.DataCenter.Location:
|
113
114
|
type: string
|
114
115
|
value: Prod
|
115
116
|
```
|
@@ -118,7 +119,7 @@ platforms:
|
|
118
119
|
|
119
120
|
Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
120
121
|
|
121
|
-
Copyright:: Copyright (c) 2015-
|
122
|
+
Copyright:: Copyright (c) 2015-2019 Chef Software, Inc.
|
122
123
|
|
123
124
|
License:: Apache License, Version 2.0
|
124
125
|
|
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'bundler/gem_tasks'
|
3
4
|
require 'rspec/core/rake_task'
|
4
5
|
require 'rubocop/rake_task'
|
@@ -17,4 +18,4 @@ rescue LoadError
|
|
17
18
|
puts 'github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs'
|
18
19
|
end
|
19
20
|
|
20
|
-
task default: [
|
21
|
+
task default: %i[spec style]
|
data/kitchen-vra.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
lib = File.expand_path('../lib', __FILE__)
|
4
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
6
|
require 'kitchen/driver/vra_version'
|
@@ -24,11 +25,11 @@ Gem::Specification.new do |spec|
|
|
24
25
|
spec.add_dependency 'highline'
|
25
26
|
spec.add_dependency 'rack', '~> 1.6' unless RUBY_VERSION.index('2.0.').nil?
|
26
27
|
spec.add_dependency 'ffi-yajl', '~> 2.2.3' unless RUBY_VERSION.index('2.0.').nil?
|
27
|
-
spec.add_development_dependency 'bundler', '
|
28
|
+
spec.add_development_dependency 'bundler', '>= 1.7'
|
28
29
|
spec.add_development_dependency 'github_changelog_generator'
|
29
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
31
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
31
32
|
spec.add_development_dependency 'simplecov', '~> 0.10'
|
32
33
|
spec.add_development_dependency 'webmock', '~> 1.21'
|
33
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 0.49.0'
|
34
35
|
end
|
data/lib/kitchen/driver/vra.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
5
|
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
@@ -46,6 +47,7 @@ module Kitchen
|
|
46
47
|
default_config :server_ready_retries, 1
|
47
48
|
default_config :cpus, 1
|
48
49
|
default_config :memory, 1024
|
50
|
+
default_config :shirt_size, nil
|
49
51
|
default_config :requested_for do |driver|
|
50
52
|
driver[:username]
|
51
53
|
end
|
@@ -54,7 +56,7 @@ module Kitchen
|
|
54
56
|
default_config :cache_credentials, false
|
55
57
|
default_config :extra_parameters, {}
|
56
58
|
default_config :private_key_path do
|
57
|
-
%w
|
59
|
+
%w[id_rsa id_dsa].map do |key|
|
58
60
|
file = File.expand_path("~/.ssh/#{key}")
|
59
61
|
file if File.exist?(file)
|
60
62
|
end.compact.first
|
@@ -71,7 +73,7 @@ module Kitchen
|
|
71
73
|
config[:password] = config[:password] || ENV['VRA_USER_PASSWORD']
|
72
74
|
c_load if config[:username].nil? && config[:password].nil?
|
73
75
|
|
74
|
-
config[:username] = ask('Enter Username: ') if config[:username].nil? || force_change
|
76
|
+
config[:username] = ask('Enter Username: e.g. username@domain') if config[:username].nil? || force_change
|
75
77
|
config[:password] = ask('Enter password: ') { |q| q.echo = '*' } if config[:password].nil? || force_change
|
76
78
|
c_save if config[:cache_credentials]
|
77
79
|
end
|
@@ -200,32 +202,33 @@ module Kitchen
|
|
200
202
|
info("Destroy request #{destroy_request.id} submitted.")
|
201
203
|
wait_for_request(destroy_request)
|
202
204
|
info('Destroy request complete.')
|
203
|
-
|
205
|
+
|
204
206
|
File.delete('.kitchen/cached_vra') if File.exist?('.kitchen/cached_vra')
|
205
207
|
info('Removed cached file')
|
206
208
|
end
|
207
209
|
|
208
|
-
def catalog_request
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
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
|
218
220
|
end
|
219
221
|
|
220
222
|
catalog_request = vra_client.catalog.request(config[:catalog_id])
|
221
223
|
|
222
224
|
catalog_request.cpus = config[:cpus]
|
223
225
|
catalog_request.memory = config[:memory]
|
226
|
+
catalog_request.shirt_size = config[:shirt_size] unless config[:shirt_size].nil?
|
224
227
|
catalog_request.requested_for = config[:requested_for]
|
225
228
|
catalog_request.lease_days = config[:lease_days] unless config[:lease_days].nil?
|
226
229
|
catalog_request.notes = config[:notes] unless config[:notes].nil?
|
227
230
|
|
228
|
-
|
231
|
+
unless config[:subtenant_name].nil?
|
229
232
|
info('Fetching Subtenant ID by Subtenant Name')
|
230
233
|
response = vra_client.fetch_subtenant_items(config[:tenant], config[:subtenant_name])
|
231
234
|
parsed_json = JSON.parse(response.body)
|
@@ -234,8 +237,8 @@ module Kitchen
|
|
234
237
|
rescue
|
235
238
|
puts "Unable to retrieve Subtenant ID from Subtenant Name: #{config[:subtenant_name]}"
|
236
239
|
end
|
237
|
-
end
|
238
|
-
catalog_request.subtenant_id
|
240
|
+
end
|
241
|
+
catalog_request.subtenant_id = config[:subtenant_id] unless config[:subtenant_id].nil?
|
239
242
|
|
240
243
|
config[:extra_parameters].each do |key, value_data|
|
241
244
|
catalog_request.set_parameters(key, value_data)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
5
|
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
@@ -19,6 +20,6 @@
|
|
19
20
|
|
20
21
|
module Kitchen
|
21
22
|
module Driver
|
22
|
-
VRA_VERSION = '2.
|
23
|
+
VRA_VERSION = '2.7.0'
|
23
24
|
end
|
24
25
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/vra_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
5
|
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
@@ -399,7 +400,7 @@ describe Kitchen::Driver::Vra do
|
|
399
400
|
allow(driver).to receive(:vra_client).and_return(vra_client)
|
400
401
|
allow(vra_client).to receive(:catalog).and_return(catalog)
|
401
402
|
allow(catalog).to receive(:request).and_return(catalog_request)
|
402
|
-
[
|
403
|
+
%i[cpus= memory= requested_for= lease_days= notes= subtenant_id= set_parameter].each do |method|
|
403
404
|
allow(catalog_request).to receive(method)
|
404
405
|
end
|
405
406
|
end
|
@@ -457,8 +458,8 @@ describe Kitchen::Driver::Vra do
|
|
457
458
|
end
|
458
459
|
|
459
460
|
it 'sets extra parmeters' do
|
460
|
-
expect(catalog_request).to receive(:
|
461
|
-
expect(catalog_request).to receive(:
|
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)
|
462
463
|
driver.catalog_request
|
463
464
|
end
|
464
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.
|
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:
|
11
|
+
date: 2020-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.7'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 0.49.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 0.49.0
|
153
153
|
description: A Test Kitchen driver for VMware vRealize Automation (vRA)
|
154
154
|
email:
|
155
155
|
- partnereng@chef.io
|
@@ -191,8 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
|
-
|
195
|
-
rubygems_version: 2.5.1
|
194
|
+
rubygems_version: 3.1.2
|
196
195
|
signing_key:
|
197
196
|
specification_version: 4
|
198
197
|
summary: A Test Kitchen driver for VMware vRealize Automation (vRA)
|