kitchen-vra 2.3.0 → 2.4.0
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 +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +21 -2
- data/lib/kitchen/driver/vra.rb +36 -14
- data/lib/kitchen/driver/vra_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc5351db8abc9e1ebed8cd6d250cd6eed5294ac3
|
|
4
|
+
data.tar.gz: dadebc21274f1612b11325524295e60e23c6c64d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1fe82016e8c6bb3042772a7b3dd42ee4d824a6ac06ca43a0e85bb9b4ddd47b6886a22d7372b5ef5e7997e99d2a975130d145fb6d6d35c7eadb87537696dc3178
|
|
7
|
+
data.tar.gz: 081cd1c7f6aee2fa0f9577323efb79de324f9e9a2328a15cdeb20336a52f00106b0d96995d21270ec8dd83819f346509f77b4fddc0114b312f7e669ed67c4635
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [2.4.0] (https://github.com/chef-partners/kitchen-vra/tree/v2.4.0) (2018-01-04)
|
|
4
|
+
[Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.3.0...2.4.0)
|
|
5
|
+
|
|
6
|
+
**Enhanced/Fixed:**
|
|
7
|
+
|
|
8
|
+
- Enhance vRA Kitchen driver to accept Catalog name as an input.
|
|
9
|
+
- Ability of vRA Kitchen driver to accept credentials from environment variable even if they are not being mentioned in the `.kitchen.yml` file
|
|
10
|
+
- Ability of vRA kitchen driver to prompt for credentials if it’s not able retrieve from `.kitchen.yml` or from environment variable.
|
|
11
|
+
- An option to not save credentials based on the usage of an existing flag.
|
|
12
|
+
- Fixed a bug in the encryption/decryption logic.
|
|
13
|
+
|
|
14
|
+
|
|
3
15
|
## [2.3.0](https://github.com/chef-partners/kitchen-vra/tree/2.3.0) (2017-07-14)
|
|
4
16
|
[Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v2.2.0...2.3.0)
|
|
5
17
|
|
|
@@ -82,4 +94,4 @@
|
|
|
82
94
|
|
|
83
95
|
|
|
84
96
|
|
|
85
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
|
97
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
|
@@ -36,7 +36,22 @@ driver:
|
|
|
36
36
|
verify_ssl: true
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
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
|
-
|
|
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
|
|
@@ -72,6 +89,7 @@ driver:
|
|
|
72
89
|
platforms:
|
|
73
90
|
- name: small
|
|
74
91
|
driver:
|
|
92
|
+
catalog_name: my_catalog_name_small
|
|
75
93
|
catalog_id: 8a189191-fea6-43eb-981e-ee0fa40f8f57
|
|
76
94
|
extra_parameters:
|
|
77
95
|
provider-mycustompropname:
|
|
@@ -82,6 +100,7 @@ platforms:
|
|
|
82
100
|
value: Non-Prod
|
|
83
101
|
- name: large
|
|
84
102
|
driver:
|
|
103
|
+
catalog_name: my_catalog_name_large
|
|
85
104
|
catalog_id: 1d7c6122-18fa-4ed6-bd13-8a33b6c6ed50
|
|
86
105
|
cpus: 2
|
|
87
106
|
extra_parameters:
|
data/lib/kitchen/driver/vra.rb
CHANGED
|
@@ -31,11 +31,12 @@ module Kitchen
|
|
|
31
31
|
kitchen_driver_api_version 2
|
|
32
32
|
plugin_version Kitchen::Driver::VRA_VERSION
|
|
33
33
|
|
|
34
|
-
default_config :username,
|
|
35
|
-
default_config :password,
|
|
34
|
+
default_config :username, nil
|
|
35
|
+
default_config :password, nil
|
|
36
36
|
required_config :base_url
|
|
37
37
|
required_config :tenant
|
|
38
|
-
|
|
38
|
+
default_config :catalog_id, nil
|
|
39
|
+
default_config :catalog_name, nil
|
|
39
40
|
|
|
40
41
|
default_config :subtenant, nil
|
|
41
42
|
default_config :verify_ssl, true
|
|
@@ -65,21 +66,26 @@ module Kitchen
|
|
|
65
66
|
end
|
|
66
67
|
|
|
67
68
|
def check_config(force_change = false)
|
|
68
|
-
|
|
69
|
-
config[:
|
|
70
|
-
config[:
|
|
71
|
-
|
|
69
|
+
config[:username] = config[:username] || ENV['VRA_USER_NAME']
|
|
70
|
+
config[:password] = config[:password] || ENV['VRA_USER_PASSWORD']
|
|
71
|
+
c_load if config[:username].nil? && config[:password].nil?
|
|
72
|
+
|
|
73
|
+
config[:username] = ask('Enter Username: ') if config[:username].nil? || force_change
|
|
74
|
+
config[:password] = ask('Enter password: ') { |q| q.echo = '*' } if config[:password].nil? || force_change
|
|
75
|
+
c_save if config[:cache_credentials]
|
|
72
76
|
end
|
|
73
77
|
|
|
74
78
|
def c_save
|
|
75
79
|
cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
|
|
76
80
|
cipher.encrypt
|
|
77
81
|
cipher.key = Digest::SHA1.hexdigest(config[:base_url])
|
|
78
|
-
|
|
79
|
-
cipher.iv =
|
|
82
|
+
iv_user = cipher.random_iv
|
|
83
|
+
cipher.iv = iv_user
|
|
80
84
|
username = cipher.update(config[:username]) + cipher.final
|
|
85
|
+
iv_pwd = cipher.random_iv
|
|
86
|
+
cipher.iv = iv_pwd
|
|
81
87
|
password = cipher.update(config[:password]) + cipher.final
|
|
82
|
-
output = "#{Base64.encode64(
|
|
88
|
+
output = "#{Base64.encode64(iv_user).strip!}:#{Base64.encode64(username).strip!}:#{Base64.encode64(iv_pwd).strip!}:#{Base64.encode64(password).strip!}"
|
|
83
89
|
file = File.open('.kitchen/cached_vra', 'w')
|
|
84
90
|
file.write(output)
|
|
85
91
|
file.close
|
|
@@ -90,14 +96,16 @@ module Kitchen
|
|
|
90
96
|
def c_load
|
|
91
97
|
if File.exist? '.kitchen/cached_vra'
|
|
92
98
|
encrypted = File.read('.kitchen/cached_vra')
|
|
93
|
-
|
|
99
|
+
iv_user = Base64.decode64(encrypted.split(':')[0] + '\n')
|
|
94
100
|
username = Base64.decode64(encrypted.split(':')[1] + "\n")
|
|
95
|
-
|
|
101
|
+
iv_pwd = Base64.decode64(encrypted.split(':')[2] + "\n")
|
|
102
|
+
password = Base64.decode64(encrypted.split(':')[3] + "\n")
|
|
96
103
|
cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
|
|
97
104
|
cipher.decrypt
|
|
98
105
|
cipher.key = Digest::SHA1.hexdigest(config[:base_url])
|
|
99
|
-
cipher.iv =
|
|
106
|
+
cipher.iv = iv_user
|
|
100
107
|
config[:username] = cipher.update(username) + cipher.final
|
|
108
|
+
cipher.iv = iv_pwd
|
|
101
109
|
config[:password] = cipher.update(password) + cipher.final
|
|
102
110
|
end
|
|
103
111
|
rescue
|
|
@@ -191,9 +199,23 @@ module Kitchen
|
|
|
191
199
|
info("Destroy request #{destroy_request.id} submitted.")
|
|
192
200
|
wait_for_request(destroy_request)
|
|
193
201
|
info('Destroy request complete.')
|
|
202
|
+
|
|
203
|
+
File.delete('.kitchen/cached_vra') if File.exist?('.kitchen/cached_vra')
|
|
204
|
+
info('Removed cached file')
|
|
194
205
|
end
|
|
195
206
|
|
|
196
207
|
def catalog_request
|
|
208
|
+
if config[:catalog_name] != nil
|
|
209
|
+
info('Fetching Catalog ID by Catalog Name')
|
|
210
|
+
response = vra_client.catalog.fetch_catalog_items(config[:catalog_name])
|
|
211
|
+
parsed_json = JSON.parse(response.body)
|
|
212
|
+
begin
|
|
213
|
+
config[:catalog_id] = parsed_json['content'][0]['catalogItemId']
|
|
214
|
+
rescue
|
|
215
|
+
puts "Unable to retrieve Catalog ID from Catalog Name: #{config[:catalog_name]}"
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
197
219
|
catalog_request = vra_client.catalog.request(config[:catalog_id])
|
|
198
220
|
|
|
199
221
|
catalog_request.cpus = config[:cpus]
|
|
@@ -211,7 +233,7 @@ module Kitchen
|
|
|
211
233
|
end
|
|
212
234
|
|
|
213
235
|
def vra_client
|
|
214
|
-
check_config
|
|
236
|
+
check_config config[:cache_credentials]
|
|
215
237
|
@client ||= ::Vra::Client.new(
|
|
216
238
|
base_url: config[:base_url],
|
|
217
239
|
username: config[:username],
|
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.4.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: 2018-01-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|