vmware-vra 2.7.0 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +14 -0
- data/lib/vra/catalog_request.rb +8 -1
- data/lib/vra/http.rb +5 -0
- data/lib/vra/request_parameters.rb +2 -0
- data/lib/vra/version.rb +1 -1
- data/spec/catalog_request_spec.rb +9 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e28bed631cab067e13738576e243460e12e5b4ab8421f984faf1261c5b70691
|
4
|
+
data.tar.gz: 1be855a3503c4a15386c885accdd75a8f5fc5fc13eb84abc82c91cfe08250b6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 300797ca6f9997718a76e9c86fd1ba9f898463a94ebc95dd8e626799e77bdd6e0cd0bec7a4290f5246c31dbebbed338c84941fc132fc71763b1d7bedd10c2b1d
|
7
|
+
data.tar.gz: 3d8e098691e4edadafa5b5c9b6768b267ad92ff5736aed899c31ed0f62969714f743f2f8cd2b96f6a23cab6fa83609810cdfd71860c7aaaf980bd8a60d25f7c9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [2.7.1](https://github.com/chef-partners/vmware-vra-gem/tree/v2.7.1) (2019-05-28)
|
4
|
+
[Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.7.0...v2.7.1)
|
5
|
+
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- Some Extra Parameters are not passing through to VRA [\#75](https://github.com/chef-partners/vmware-vra-gem/issues/75)
|
9
|
+
|
10
|
+
**Merged pull requests:**
|
11
|
+
|
12
|
+
- Add support for boolean vRA parameters, fix deep merge, add tracing [\#76](https://github.com/chef-partners/vmware-vra-gem/pull/76) ([stuartpreston](https://github.com/stuartpreston))
|
13
|
+
|
3
14
|
## [2.7.0](https://github.com/chef-partners/vmware-vra-gem/tree/v2.7.0) (2019-05-10)
|
4
15
|
[Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.6.1...v2.7.0)
|
5
16
|
|
data/README.md
CHANGED
@@ -296,6 +296,20 @@ vra = Vra::Client.new(username: 'devmgr@corp.local', password: 'mypassword', ten
|
|
296
296
|
client.page_size = 100
|
297
297
|
```
|
298
298
|
|
299
|
+
### Debugging
|
300
|
+
|
301
|
+
To aid diagnosis of deep API issues, set the following environment variable to enable logging of all API requests. Note that this will include requests to retrieve the bearer token.
|
302
|
+
|
303
|
+
MacOS/Linux:
|
304
|
+
```ruby
|
305
|
+
export VRA_HTTP_TRACE=1
|
306
|
+
```
|
307
|
+
|
308
|
+
Windows:
|
309
|
+
```powershell
|
310
|
+
$env:VRA_HTTP_TRACE=1
|
311
|
+
```
|
312
|
+
|
299
313
|
## License and Authors
|
300
314
|
|
301
315
|
Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
data/lib/vra/catalog_request.rb
CHANGED
@@ -18,6 +18,13 @@
|
|
18
18
|
#
|
19
19
|
require "vra/catalog_item"
|
20
20
|
|
21
|
+
class ::Hash
|
22
|
+
def deep_merge(second)
|
23
|
+
merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
|
24
|
+
merge(second, &merger)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
21
28
|
module Vra
|
22
29
|
class CatalogRequest
|
23
30
|
attr_reader :catalog_id, :catalog_item, :client, :custom_fields
|
@@ -96,7 +103,7 @@ module Vra
|
|
96
103
|
hash_payload["requestedFor"] = @requested_for
|
97
104
|
hash_payload["data"]["_leaseDays"] = @lease_days
|
98
105
|
hash_payload["description"] = @notes
|
99
|
-
hash_payload["data"][
|
106
|
+
hash_payload["data"] = hash_payload["data"].deep_merge(parameters["data"]) unless parameters.empty?
|
100
107
|
hash_payload.to_json
|
101
108
|
end
|
102
109
|
|
data/lib/vra/http.rb
CHANGED
@@ -8,6 +8,11 @@ module Vra
|
|
8
8
|
request = Request.new(params)
|
9
9
|
response = request.call
|
10
10
|
response = response.forward(request).call until response.final?
|
11
|
+
if ENV["VRA_HTTP_TRACE"]
|
12
|
+
puts "#{request.params[:method].upcase} #{request.params[:url]}" unless request.params.nil?
|
13
|
+
puts ">>>>> #{JSON.parse(request.params[:payload]).to_json}" unless request.params[:payload].nil?
|
14
|
+
puts "<<<<< #{JSON.parse(response.body).to_json}" unless response.body.nil?
|
15
|
+
end
|
11
16
|
raise error(response) unless response.success?
|
12
17
|
response
|
13
18
|
end
|
data/lib/vra/version.rb
CHANGED
@@ -136,15 +136,18 @@ describe Vra::CatalogRequest do
|
|
136
136
|
it "properly handles additional parameters" do
|
137
137
|
request.set_parameter("param1", "string", "my string")
|
138
138
|
request.set_parameter("param2", "integer", "2468")
|
139
|
+
request.set_parameter("param3", "boolean", "true")
|
139
140
|
|
140
141
|
template = File.read("spec/fixtures/resource/catalog_request.json")
|
141
142
|
payload = JSON.parse(request.merge_payload(template))
|
142
|
-
param1 = payload["data"]["
|
143
|
-
param2 = payload["data"]["
|
143
|
+
param1 = payload["data"]["param1"]
|
144
|
+
param2 = payload["data"]["param2"]
|
145
|
+
param3 = payload["data"]["param3"]
|
144
146
|
expect(param1).to be_a(String)
|
145
147
|
expect(param2).to be_a(Integer)
|
146
148
|
expect(param1).to eq "my string"
|
147
149
|
expect(param2).to eq 2468
|
150
|
+
expect(param3).to be_truthy
|
148
151
|
end
|
149
152
|
|
150
153
|
it "properly handles additional nested parameters" do
|
@@ -153,8 +156,8 @@ describe Vra::CatalogRequest do
|
|
153
156
|
|
154
157
|
template = File.read("spec/fixtures/resource/catalog_request.json")
|
155
158
|
payload = JSON.parse(request.merge_payload(template))
|
156
|
-
param1 = payload["data"]["
|
157
|
-
param2 = payload["data"]["
|
159
|
+
param1 = payload["data"]["BP1"]["data"]["param1"]
|
160
|
+
param2 = payload["data"]["BP1"]["data"]["BP2"]["data"]["param2"]
|
158
161
|
expect(param1).to be_a(String)
|
159
162
|
expect(param2).to be_a(Integer)
|
160
163
|
expect(param1).to eq "my string"
|
@@ -183,8 +186,8 @@ describe Vra::CatalogRequest do
|
|
183
186
|
|
184
187
|
template = File.read("spec/fixtures/resource/catalog_request.json")
|
185
188
|
payload = JSON.parse(request.merge_payload(template))
|
186
|
-
param1 = payload["data"]["
|
187
|
-
param2 = payload["data"]["
|
189
|
+
param1 = payload["data"]["BP1"]["data"]["param1"]
|
190
|
+
param2 = payload["data"]["BP1"]["data"]["BP2"]["data"]["param2"]
|
188
191
|
|
189
192
|
expect(param1).to be_a(String)
|
190
193
|
expect(param2).to be_a(Integer)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmware-vra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Leff
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-05-
|
12
|
+
date: 2019-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi-yajl
|