vmware-vra 2.6.1 → 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: c5dcc8f5abbb59b980895b3970c86f73e49fe379
4
- data.tar.gz: 78746f7b4706f0ae7adcce6cffcd8a2f5fd178c2
2
+ SHA256:
3
+ metadata.gz: adc7871ce36fca6a61e634ea47bd4453e12d0c57fd2a53b30d67b327f819a7e5
4
+ data.tar.gz: 8f9ad1fc148858c9f686c53f0818a3ad8af418eaa8dac845e2b36833b60274cf
5
5
  SHA512:
6
- metadata.gz: 26479fc2672a80ddf7b83f9b5bafedbe803304b1f580ffcd7603512f08a8e936d7b14933c36be801a010728441c0502cc55d7822c9591eb5b5c9bc9b6cfa294a
7
- data.tar.gz: ccd9fdf91aa926facc9bb8d8819fa73a653217b349ea79da6bc490917df1958a9ab5346d8f48c0090a4c764ba84303297997a6a8b2ddc1e604503963a3fafbaa
6
+ metadata.gz: e007662f641db9438846aecb6bd5f2063cb55c961b1131b85433185cb86b8031b0e6978441c35bd7d55d67daf02667ee58ca8c025f58872569d5ed84c8ba9c91
7
+ data.tar.gz: 0343c931007f55fbbbe1fce15b516674a1ae46f74630d1d7a2b529d2c7068386e5b1a087447b58ac9ca68de06b1112a773acf406fe97de93a85af6cf57e62654
data/.travis.yml CHANGED
@@ -2,7 +2,7 @@ language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
4
  rvm:
5
- - 2.3.1
5
+ - 2.6.3
6
6
  branches:
7
7
  only:
8
8
  - master
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # Change Log
2
2
 
3
- ## [2.6.1](https://github.com/chef-partners/vmware-vra-gem/tree/2.6.1) (2018-07-31)
3
+ ## [2.7.0](https://github.com/chef-partners/vmware-vra-gem/tree/v2.7.0) (2019-05-10)
4
+ [Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.6.1...v2.7.0)
5
+
6
+ **Closed issues:**
7
+
8
+ - Extra Parameters Not Being Sent to vRA [\#73](https://github.com/chef-partners/vmware-vra-gem/issues/73)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - vRA7 multiple fixes for nested, non-nested and merged parameters for a Blueprint [\#74](https://github.com/chef-partners/vmware-vra-gem/pull/74) ([stuartpreston](https://github.com/stuartpreston))
13
+
14
+ ## [2.6.1](https://github.com/chef-partners/vmware-vra-gem/tree/v2.6.1) (2018-07-31)
4
15
  [Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.6.0...2.6.1)
5
16
 
6
17
  **Closed issues:**
@@ -21,8 +21,8 @@ require "vra/catalog_item"
21
21
  module Vra
22
22
  class CatalogRequest
23
23
  attr_reader :catalog_id, :catalog_item, :client, :custom_fields
24
- attr_writer :subtenant_id
25
- attr_accessor :cpus, :memory, :requested_for, :lease_days, :notes, :template_payload
24
+ attr_writer :subtenant_id, :template_payload
25
+ attr_accessor :cpus, :memory, :requested_for, :lease_days, :notes
26
26
 
27
27
  def initialize(client, catalog_id, opts = {})
28
28
  @client = client
@@ -96,6 +96,8 @@ module Vra
96
96
  hash_payload["requestedFor"] = @requested_for
97
97
  hash_payload["data"]["_leaseDays"] = @lease_days
98
98
  hash_payload["description"] = @notes
99
+ hash_payload["data"][blueprint_name]["data"].merge!(parameters["data"]) unless parameters.empty?
100
+ hash_payload.to_json
99
101
  end
100
102
 
101
103
  # @return [String] - the current catalog template payload merged with the settings applied from this request
@@ -111,9 +113,8 @@ module Vra
111
113
  # @return [Vra::Request] - submits and returns the request, validating before hand
112
114
  def submit
113
115
  validate_params!
114
-
115
116
  begin
116
- post_response = client.http_post("/catalog-service/api/consumer/entitledCatalogItems/#{@catalog_id}/requests", template_payload)
117
+ post_response = client.http_post("/catalog-service/api/consumer/entitledCatalogItems/#{@catalog_id}/requests", merged_payload)
117
118
  rescue Vra::Exception::HTTPError => e
118
119
  raise Vra::Exception::RequestError, "Unable to submit request: #{e.errors.join(', ')}"
119
120
  rescue
data/lib/vra/client.rb CHANGED
@@ -71,7 +71,7 @@ module Vra
71
71
  {
72
72
  "username" => @username,
73
73
  "password" => @password.value,
74
- "tenant" => @tenant,
74
+ "tenant" => @tenant,
75
75
  }
76
76
  end
77
77
 
@@ -51,7 +51,7 @@ module Vra
51
51
 
52
52
  def set(key, type, value)
53
53
  if key.to_s.include? "~"
54
- split_key = key.split("~")
54
+ split_key = key.to_s.split("~")
55
55
  parent = nil
56
56
  split_key.each_with_index do |item, index|
57
57
  if index == 0
@@ -135,7 +135,6 @@ module Vra
135
135
 
136
136
  def to_vra
137
137
  hash = {}
138
-
139
138
  if @children.count > 0
140
139
  hash[@key] = {}
141
140
 
@@ -148,7 +147,7 @@ module Vra
148
147
  hash[@key] = format_value
149
148
  end
150
149
 
151
- hash
150
+ hash.each_with_object({}) { |(key, value), h| h[key.to_s] = value }
152
151
  end
153
152
 
154
153
  def format_value
data/lib/vra/resource.rb CHANGED
@@ -178,7 +178,7 @@ module Vra
178
178
  resource_views = @client.http_get("/catalog-service/api/consumer/requests/#{request_id}/resourceViews")
179
179
 
180
180
  JSON.parse(resource_views.body)["content"].each do |content|
181
- if content.has_key?("data") &&
181
+ if content.key?("data") &&
182
182
  !(content["data"]["ip_address"].nil? ||
183
183
  content["data"]["ip_address"] == "")
184
184
  addrs << content["data"]["ip_address"]
data/lib/vra/version.rb CHANGED
@@ -18,5 +18,5 @@
18
18
  #
19
19
 
20
20
  module Vra
21
- VERSION = "2.6.1"
21
+ VERSION = "2.7.0"
22
22
  end
@@ -139,9 +139,8 @@ describe Vra::CatalogRequest do
139
139
 
140
140
  template = File.read("spec/fixtures/resource/catalog_request.json")
141
141
  payload = JSON.parse(request.merge_payload(template))
142
- param1 = payload["data"]["param1"]
143
- param2 = payload["data"]["param2"]
144
-
142
+ param1 = payload["data"]["my_blueprint"]["data"]["param1"]
143
+ param2 = payload["data"]["my_blueprint"]["data"]["param2"]
145
144
  expect(param1).to be_a(String)
146
145
  expect(param2).to be_a(Integer)
147
146
  expect(param1).to eq "my string"
@@ -154,9 +153,8 @@ describe Vra::CatalogRequest do
154
153
 
155
154
  template = File.read("spec/fixtures/resource/catalog_request.json")
156
155
  payload = JSON.parse(request.merge_payload(template))
157
- param1 = payload["data"]["BP1"]["data"]["param1"]
158
- param2 = payload["data"]["BP1"]["data"]["BP2"]["data"]["param2"]
159
-
156
+ param1 = payload["data"]["my_blueprint"]["data"]["BP1"]["data"]["param1"]
157
+ param2 = payload["data"]["my_blueprint"]["data"]["BP1"]["data"]["BP2"]["data"]["param2"]
160
158
  expect(param1).to be_a(String)
161
159
  expect(param2).to be_a(Integer)
162
160
  expect(param1).to eq "my string"
@@ -185,8 +183,8 @@ describe Vra::CatalogRequest do
185
183
 
186
184
  template = File.read("spec/fixtures/resource/catalog_request.json")
187
185
  payload = JSON.parse(request.merge_payload(template))
188
- param1 = payload["data"]["BP1"]["data"]["param1"]
189
- param2 = payload["data"]["BP1"]["data"]["BP2"]["data"]["param2"]
186
+ param1 = payload["data"]["my_blueprint"]["data"]["BP1"]["data"]["param1"]
187
+ param2 = payload["data"]["my_blueprint"]["data"]["BP1"]["data"]["BP2"]["data"]["param2"]
190
188
 
191
189
  expect(param1).to be_a(String)
192
190
  expect(param2).to be_a(Integer)
data/spec/client_spec.rb CHANGED
@@ -133,7 +133,7 @@ describe Vra::Client do
133
133
  payload = {
134
134
  "username" => "user@corp.local",
135
135
  "password" => "password",
136
- "tenant" => "tenant",
136
+ "tenant" => "tenant",
137
137
  }.to_json
138
138
 
139
139
  it "posts to the tokens API endpoint" do
@@ -327,7 +327,7 @@ describe Vra::Resource do
327
327
  {
328
328
  "username" => "user@corp.local",
329
329
  "password" => "password",
330
- "tenant" => "tenant",
330
+ "tenant" => "tenant",
331
331
  }.to_json
332
332
  end
333
333
 
@@ -343,23 +343,23 @@ describe Vra::Resource do
343
343
  :post,
344
344
  "https://vra.corp.local/identity/api/tokens"
345
345
  ).with(
346
- :body => authn_payload,
347
- :headers => { "Accept" => "application/json", "Content-Type" => "application/json" }
346
+ body: authn_payload,
347
+ headers: { "Accept" => "application/json", "Content-Type" => "application/json" }
348
348
  ).to_return(
349
- :status => 200,
350
- :body => '{"id":"12345"}',
351
- :headers => {}
349
+ status: 200,
350
+ body: '{"id":"12345"}',
351
+ headers: {}
352
352
  )
353
353
 
354
354
  stub_request(
355
355
  :head,
356
356
  "https://vra.corp.local/identity/api/tokens/12345"
357
357
  ).with(
358
- :headers => { "Accept" => "application/json", "Authorization" => "Bearer 12345", "Content-Type" => "application/json" }
358
+ headers: { "Accept" => "application/json", "Authorization" => "Bearer 12345", "Content-Type" => "application/json" }
359
359
  ).to_return(
360
- :status => 204,
361
- :body => "",
362
- :headers => {}
360
+ status: 204,
361
+ body: "",
362
+ headers: {}
363
363
  )
364
364
 
365
365
  stub_request(
data/vmware-vra.gemspec CHANGED
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "pry", "~> 0.10"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
- spec.add_development_dependency "webmock", "~> 1.21"
31
+ spec.add_development_dependency "webmock", "~> 3.5"
32
32
 
33
33
  end
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.6.1
4
+ version: 2.7.0
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: 2018-07-31 00:00:00.000000000 Z
12
+ date: 2019-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi-yajl
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '1.21'
132
+ version: '3.5'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '1.21'
139
+ version: '3.5'
140
140
  description: Client gem for interacting with VMware vRealize Automation.
141
141
  email:
142
142
  - jj@chef.io
@@ -151,7 +151,6 @@ files:
151
151
  - ".travis.yml"
152
152
  - CHANGELOG.md
153
153
  - Gemfile
154
- - Jenkinsfile
155
154
  - LICENSE.txt
156
155
  - README.md
157
156
  - Rakefile
@@ -208,8 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
207
  - !ruby/object:Gem::Version
209
208
  version: '0'
210
209
  requirements: []
211
- rubyforge_project:
212
- rubygems_version: 2.5.1
210
+ rubygems_version: 3.0.3
213
211
  signing_key:
214
212
  specification_version: 4
215
213
  summary: Client gem for interacting with VMware vRealize Automation.
data/Jenkinsfile DELETED
@@ -1,31 +0,0 @@
1
- pipeline {
2
- agent {
3
- docker {
4
- args '-u root'
5
- image 'localhost:5000/jjkeysv3'
6
- }
7
-
8
- }
9
- triggers {
10
- pollSCM('H * * * *')
11
- }
12
- stages {
13
- stage('Pull down the ChefDK') {
14
- steps {
15
- sh '''apt-get update
16
- apt-get install -y curl sudo git build-essential
17
- curl -L https://chef.io/chef/install.sh | sudo bash -s -- -P chefdk -c current'''
18
- }
19
- }
20
- stage('Bundle') {
21
- steps {
22
- sh 'chef exec bundle install'
23
- }
24
- }
25
- stage('Rake') {
26
- steps {
27
- sh 'chef exec bundle exec rake '
28
- }
29
- }
30
- }
31
- }