vmware-vra 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -6
- data/README.md +9 -1
- data/lib/vra/client.rb +5 -0
- data/lib/vra/resource.rb +13 -16
- data/lib/vra/version.rb +1 -1
- data/spec/fixtures/resource/ip_address_third_element.txt +1 -0
- data/spec/fixtures/resource/vm_resource.json +1 -0
- data/spec/resource_spec.rb +68 -7
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eac729199b904cd20391694456f20306e8b11e5f
|
4
|
+
data.tar.gz: 5b98695fbb10313a0c3d836cf132a7ce31eccf2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06157a18438d667f5ac70aaea02d9ee9894473655ecb545a952ac151428242d62b82b6bfaf7e407417c7510a045fb69ec811db627dcd9d0aa16c316b2a9bd88a
|
7
|
+
data.tar.gz: 846208751739fe7ba682d9fc879f9590a137e9a6a25f2154ce5352fbd630819ac33079ef890339aafffcb4230b9ab64e55df6c713f567bcac3c4b77cacb4ed91
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,27 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [
|
4
|
-
[Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.5.1...2.5.2)
|
3
|
+
## [v2.6.0](https://github.com/chef-partners/vmware-vra-gem/tree/v2.6.0)
|
5
4
|
|
6
|
-
|
5
|
+
[Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.5.2...v2.6.0)
|
7
6
|
|
8
|
-
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- undefined method `\[\]' for nil:NilClass if data for json content is of single entity [\#55](https://github.com/chef-partners/vmware-vra-gem/issues/55)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Accept subtenant name as input in kitchen.yml [\#67](https://github.com/chef-partners/vmware-vra-gem/pull/67) ([vinuphilip](https://github.com/vinuphilip))
|
14
|
+
- Lgustafson/fix 65 [\#66](https://github.com/chef-partners/vmware-vra-gem/pull/66) ([lgustafson](https://github.com/lgustafson))
|
15
|
+
|
16
|
+
## [v2.5.2](https://github.com/chef-partners/vmware-vra-gem/tree/v2.5.2) (2018-01-22)
|
17
|
+
[Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.5.1...v2.5.2)
|
18
|
+
|
19
|
+
**Merged pull requests:**
|
20
|
+
|
21
|
+
- Added a method to retrieve catalog id's from catalog name [\#64](https://github.com/chef-partners/vmware-vra-gem/pull/64) ([rupeshpatel88](https://github.com/rupeshpatel88))
|
9
22
|
|
10
|
-
## [
|
11
|
-
[Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.5.0...
|
23
|
+
## [v2.5.1](https://github.com/chef-partners/vmware-vra-gem/tree/v2.5.1) (2017-10-19)
|
24
|
+
[Full Changelog](https://github.com/chef-partners/vmware-vra-gem/compare/v2.5.0...v2.5.1)
|
12
25
|
|
13
26
|
**Merged pull requests:**
|
14
27
|
|
data/README.md
CHANGED
@@ -78,7 +78,15 @@ vra.catalog.fetch_catalog_items('my_catalog_name')
|
|
78
78
|
|
79
79
|
vRA requires your sub-tenant (a.k.a. "business group") to be specified when requesting an item from the catalog. If the catalog item you are requesting is specifically created for a given business group, the gem will use that ID automatically without you needing to specify it.
|
80
80
|
|
81
|
-
|
81
|
+
An easier option has been provided to end user to provide a friendly sub-tenant name instead of sub-tenant id, and the driver would take care of retrieving the sub-tenant id for the corresponding sub-tenant name. Tenant name is also required along with sub-tenant name to retrieve sub-tenant id.
|
82
|
+
|
83
|
+
To retrieve sub-tenant id from sub-tenant name:
|
84
|
+
|
85
|
+
```
|
86
|
+
vra.fetch_subtenant_items('my_tenant', 'my_subtenant_name')
|
87
|
+
```
|
88
|
+
|
89
|
+
However, if there is no sub-tenant ID or sub-tenant name available for us to use, you will receive an error when you submit:
|
82
90
|
|
83
91
|
```
|
84
92
|
request = catalog_request.submit
|
data/lib/vra/client.rb
CHANGED
data/lib/vra/resource.rb
CHANGED
@@ -172,27 +172,24 @@ module Vra
|
|
172
172
|
|
173
173
|
request_id = @resource_data["requestId"]
|
174
174
|
|
175
|
-
resource_views = @client.http_get("/catalog-service/api/consumer/requests/#{request_id}/resourceViews")
|
176
|
-
|
177
|
-
data_zero = JSON.parse(resource_views.body)["content"][0]["data"]["ip_address"]
|
178
|
-
data_one = JSON.parse(resource_views.body)["content"][1]["data"]["ip_address"]
|
179
|
-
|
180
175
|
print "Waiting For vRA to collect the IP"
|
181
|
-
|
176
|
+
|
177
|
+
loop do
|
182
178
|
resource_views = @client.http_get("/catalog-service/api/consumer/requests/#{request_id}/resourceViews")
|
183
|
-
|
184
|
-
|
179
|
+
|
180
|
+
JSON.parse(resource_views.body)["content"].each do |content|
|
181
|
+
if content.has_key?("data") &&
|
182
|
+
!(content["data"]["ip_address"].nil? ||
|
183
|
+
content["data"]["ip_address"] == "")
|
184
|
+
addrs << content["data"]["ip_address"]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
break unless addrs.empty?
|
189
|
+
|
185
190
|
sleep 10
|
186
|
-
print "."
|
187
191
|
end
|
188
192
|
|
189
|
-
ip_address = if JSON.parse(resource_views.body)["content"][0]["data"]["ip_address"].nil?
|
190
|
-
JSON.parse(resource_views.body)["content"][1]["data"]["ip_address"]
|
191
|
-
else
|
192
|
-
JSON.parse(resource_views.body)["content"][0]["data"]["ip_address"]
|
193
|
-
end
|
194
|
-
|
195
|
-
addrs << ip_address
|
196
193
|
addrs
|
197
194
|
end
|
198
195
|
|
data/lib/vra/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"links":[],"content":[{"@type":"CatalogResourceView","links":[{"@type":"link","rel":"GET: Catalog Item","href":"https://vra71.tirefi.re/catalog-service/api/consumer/entitledCatalogItemViews/2d6d5481-ebb0-4bdc-8af9-b75043a86386"},{"@type":"link","rel":"GET: Request","href":"https://vra71.tirefi.re/catalog-service/api/consumer/requests/bcd175ac-1c02-4a00-b4c8-fa585f23fd2d"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.cafe.composition@resource.action.deployment.changelease.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/c3595f52-e35a-448c-8409-7ce0c554cfba/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.cafe.composition@resource.action.deployment.changelease.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/c3595f52-e35a-448c-8409-7ce0c554cfba/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.cafe.composition@resource.action.deployment.changeowner.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/00f03ade-3850-40c8-93b8-4b093b5bf7c4/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.cafe.composition@resource.action.deployment.changeowner.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/00f03ade-3850-40c8-93b8-4b093b5bf7c4/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.cafe.composition@resource.action.deployment.destroy.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/306fbd9b-7129-405a-8c07-fedf32585f3d/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.cafe.composition@resource.action.deployment.destroy.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/306fbd9b-7129-405a-8c07-fedf32585f3d/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.cafe.composition@resource.action.deployment.archive.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/e5759af9-56d8-4598-ab7f-4ca6d45bd385/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.cafe.composition@resource.action.deployment.archive.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/e5759af9-56d8-4598-ab7f-4ca6d45bd385/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.cafe.composition@resource.action.deployment.scalein.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/6b358c70-ac66-4634-951b-73ab4e36c78d/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.cafe.composition@resource.action.deployment.scalein.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/6b358c70-ac66-4634-951b-73ab4e36c78d/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.cafe.composition@resource.action.deployment.scaleout.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/2c50de13-d5aa-4958-9af9-d2451675a2b3/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.cafe.composition@resource.action.deployment.scaleout.name}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/700f9e3c-c7bd-41d7-9683-5d3051a8e238/actions/2c50de13-d5aa-4958-9af9-d2451675a2b3/requests"},{"@type":"link","rel":"GET: Child Resources","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resourceViews?managedOnly=false&withExtendedData=true&withOperations=true&%24filter=parentResource%20eq%20%27700f9e3c-c7bd-41d7-9683-5d3051a8e238%27"}],"resourceId":"700f9e3c-c7bd-41d7-9683-5d3051a8e238","iconId":"composition.blueprint.png","name":"test-66303366","description":null,"status":null,"catalogItemId":"2d6d5481-ebb0-4bdc-8af9-b75043a86386","catalogItemLabel":"test","requestId":"bcd175ac-1c02-4a00-b4c8-fa585f23fd2d","resourceType":"composition.resource.type.deployment","owners":["vRA Admin"],"businessGroupId":"d0fb4a04-7099-4ba1-a262-b578e129a758","tenantId":"vsphere.local","dateCreated":"2016-12-01T19:59:55.000Z","lastUpdated":"2016-12-01T20:05:03.086Z","lease":{"start":"2016-12-01T19:59:54.988Z"},"costs":null,"costToDate":null,"totalCost":null,"parentResourceId":null,"hasChildren":true,"data":{}},{"@type":"CatalogResourceView","links":[{"@type":"link","rel":"GET: Request","href":"https://vra71.tirefi.re/catalog-service/api/consumer/requests/bcd175ac-1c02-4a00-b4c8-fa585f23fd2d"},{"@type":"link","rel":"GET: Parent Resource","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resourceViews/700f9e3c-c7bd-41d7-9683-5d3051a8e238"}],"resourceId":"a1337573-c379-4f40-aaec-ce81c0c16ce6","iconId":"existing_network","name":"VMNetwork","description":null,"status":null,"catalogItemId":null,"catalogItemLabel":null,"requestId":"bcd175ac-1c02-4a00-b4c8-fa585f23fd2d","resourceType":"Infrastructure.Network.Network.Existing","owners":["vRA Admin"],"businessGroupId":"d0fb4a04-7099-4ba1-a262-b578e129a758","tenantId":"vsphere.local","dateCreated":"2018-02-22T20:23:11.203Z","lastUpdated":"2018-02-22T20:30:09.724Z","lease":{"start":"2018-02-22T20:22:50.171Z","end":"2018-02-24T20:22:50.171Z"},"costs":null,"costToDate":null,"totalCost":null,"parentResourceId":"700f9e3c-c7bd-41d7-9683-5d3051a8e238","hasChildren":false,"data":{"Description":" ","Name":"VMNetwork","_hasChildren":false,"_leaseDays":2,"_number_of_instances":1,"cpu":"1","dns":{"componentTypeId":"com.vmware.csp.iaas.blueprint.service","componentId":null,"classId":"Infrastructure.Network.Network.DnsWins","typeFilter":null,"data":{"alternate_wins":null,"dns_search_suffix":"bogus.invalid","dns_suffix":"bogus.invalid","preferred_wins":null,"primary_dns":"172.16.20.50","secondary_dns":"172.16.20.51"}},"gateway":"172.16.20.1","ip_ranges":[{"componentTypeId":"com.vmware.csp.iaas.blueprint.service","componentId":null,"classId":"Infrastructure.Network.Network.IpRanges","typeFilter":null,"data":{"description":"","end_ip":"172.16.20.200","id":"51ca3210-5e10-4f03-a5a0-02daa701ca36","name":"VMNetwork","start_ip":"172.16.20.10"}}],"memory":"2048","network_profile":"VM Network","providerBindingId":"test","subnet_mask":"255.255.255.0"}},{"@type":"CatalogResourceView","links":[{"@type":"link","rel":"GET: Request","href":"https://vra71.tirefi.re/catalog-service/api/consumer/requests/bcd175ac-1c02-4a00-b4c8-fa585f23fd2d"},{"@type":"link","rel":"GET: Parent Resource","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resourceViews/700f9e3c-c7bd-41d7-9683-5d3051a8e238"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.ChangeLease}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/6bfd31da-dc94-4b3d-9d11-a76ca6466fee/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.ChangeLease}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/6bfd31da-dc94-4b3d-9d11-a76ca6466fee/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@csp.places.iaas.item.window.ConnectViaVmrc.label}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/beeea7b5-b75c-46ab-b3f7-92e87419d025/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@csp.places.iaas.item.window.ConnectViaVmrc.label}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/beeea7b5-b75c-46ab-b3f7-92e87419d025/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@csp.places.iaas.item.noform.ConnectViaRdp.label}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/33b4eb4b-1602-4d1e-802b-41c54f56b97c/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@csp.places.iaas.item.noform.ConnectViaRdp.label}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/33b4eb4b-1602-4d1e-802b-41c54f56b97c/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@csp.places.iaas.item.nowindow.ConnectViaNativeVmrc.label}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/39fb6669-f224-45ed-9b48-4a48a828f10a/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@csp.places.iaas.item.nowindow.ConnectViaNativeVmrc.label}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/39fb6669-f224-45ed-9b48-4a48a828f10a/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.virtual.CreateSnapshot}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/ef01fe39-132d-4800-85b5-987a345202b2/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.virtual.CreateSnapshot}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/ef01fe39-132d-4800-85b5-987a345202b2/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.virtual.Destroy}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/4a0cfa3b-b686-43c7-9b31-600b99812b15/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.virtual.Destroy}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/4a0cfa3b-b686-43c7-9b31-600b99812b15/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Expire}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/5b0f7c6a-0bf1-497f-ab10-d0536ff0cdde/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Expire}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/5b0f7c6a-0bf1-497f-ab10-d0536ff0cdde/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.InstallTools}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/7bdb5a37-5a18-4365-bc4a-f1bba27df5f7/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.InstallTools}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/7bdb5a37-5a18-4365-bc4a-f1bba27df5f7/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Reset}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/7b6538e2-6eec-4618-bc92-7aafaf9f147e/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Reset}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/7b6538e2-6eec-4618-bc92-7aafaf9f147e/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.PowerOff}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/1f9ffa9a-b5cf-4337-b097-6c4dc0bd52b7/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.PowerOff}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/1f9ffa9a-b5cf-4337-b097-6c4dc0bd52b7/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Reboot}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/37e2bb8f-ab3c-4e4c-854b-71f85c1db9ee/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Reboot}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/37e2bb8f-ab3c-4e4c-854b-71f85c1db9ee/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Reconfigure}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/14af2ac6-827d-4854-a797-fe2b587bc968/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Reconfigure}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/14af2ac6-827d-4854-a797-fe2b587bc968/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Reprovision}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/eed48ad5-3e8e-41f2-a206-75ae79041779/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Reprovision}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/eed48ad5-3e8e-41f2-a206-75ae79041779/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Shutdown}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/a4fd65a6-8abc-493e-8315-3345b673366f/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Shutdown}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/a4fd65a6-8abc-493e-8315-3345b673366f/requests"},{"@type":"link","rel":"GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Suspend}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/e1bdb142-1136-40a8-b49e-84ac5d3ed0b1/requests/template"},{"@type":"link","rel":"POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.Suspend}","href":"https://vra71.tirefi.re/catalog-service/api/consumer/resources/3bf23388-38fb-44ef-ab1e-325ad1a1c582/actions/e1bdb142-1136-40a8-b49e-84ac5d3ed0b1/requests"}],"resourceId":"3bf23388-38fb-44ef-ab1e-325ad1a1c582","iconId":"Infrastructure.CatalogItem.Machine.Virtual.vSphere","name":"vra7-32","description":null,"status":"On","catalogItemId":null,"catalogItemLabel":null,"requestId":"bcd175ac-1c02-4a00-b4c8-fa585f23fd2d","resourceType":"Infrastructure.Virtual","owners":["vRA Admin"],"businessGroupId":"d0fb4a04-7099-4ba1-a262-b578e129a758","tenantId":"vsphere.local","dateCreated":"2016-12-01T20:03:59.946Z","lastUpdated":"2016-12-01T20:05:03.086Z","lease":{"start":"2016-12-01T19:59:54.988Z"},"costs":null,"costToDate":null,"totalCost":null,"parentResourceId":"700f9e3c-c7bd-41d7-9683-5d3051a8e238","hasChildren":false,"data":{"ChangeLease":true,"ChangeOwner":true,"Component":"vSphere_Machine_1","ConnectViaNativeVmrc":true,"ConnectViaRdp":true,"ConnectViaVmrc":true,"CreateSnapshot":true,"DISK_VOLUMES":[{"componentTypeId":"com.vmware.csp.component.iaas.proxy.provider","componentId":null,"classId":"dynamicops.api.model.DiskInputModel","typeFilter":null,"data":{"DISK_CAPACITY":28,"DISK_INPUT_ID":"DISK_INPUT_ID1","DISK_LABEL":"Hard disk 1"}}],"Destroy":true,"EXTERNAL_REFERENCE_ID":"vm-171","Expire":true,"IS_COMPONENT_MACHINE":false,"InstallTools":true,"MachineBlueprintName":"test","MachineCPU":1,"MachineDailyCost":0,"MachineDestructionDate":null,"MachineExpirationDate":null,"MachineGroupName":"tirefireadmins","MachineGuestOperatingSystem":null,"MachineInterfaceDisplayName":"vSphere (vCenter)","MachineInterfaceType":"vSphere","MachineMemory":4096,"MachineName":"vra7-32","MachineReservationName":"test","MachineStorage":28,"MachineType":"Virtual","NETWORK_LIST":[{"componentTypeId":"com.vmware.csp.component.iaas.proxy.provider","componentId":null,"classId":"dynamicops.api.model.NetworkViewModel","typeFilter":null,"data":{"NETWORK_MAC_ADDRESS":"00:50:56:8a:62:e1","NETWORK_NAME":"VM Network"}}],"PowerOff":true,"Reboot":true,"Reconfigure":true,"Reprovision":true,"Reset":true,"SNAPSHOT_LIST":[],"Shutdown":true,"Suspend":true,"VirtualMachine.Admin.UUID":"500a9c29-ab12-fc1f-6bd9-57c78eb2c3de","endpointExternalReferenceId":"1a19bcb7-e6b9-487d-b816-a10c91738fd1","ip_address":"172.16.20.147","machineId":"8bd21553-4609-41ef-bebf-60f7c66a28e0"}}],"metadata":{"size":20,"totalElements":2,"totalPages":1,"number":1,"offset":0}}
|
data/spec/resource_spec.rb
CHANGED
@@ -323,13 +323,74 @@ describe Vra::Resource do
|
|
323
323
|
end
|
324
324
|
|
325
325
|
describe "#ip_addresses" do
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
326
|
+
let(:authn_payload) do
|
327
|
+
{
|
328
|
+
"username" => "user@corp.local",
|
329
|
+
"password" => "password",
|
330
|
+
"tenant" => "tenant",
|
331
|
+
}.to_json
|
332
|
+
end
|
333
|
+
|
334
|
+
let(:resource_view_body) do
|
335
|
+
File.read(File.join(File.dirname(__FILE__),
|
336
|
+
"fixtures",
|
337
|
+
"resource",
|
338
|
+
"ip_address.txt"))
|
339
|
+
end
|
340
|
+
|
341
|
+
before do
|
342
|
+
stub_request(
|
343
|
+
:post,
|
344
|
+
"https://vra.corp.local/identity/api/tokens"
|
345
|
+
).with(
|
346
|
+
:body => authn_payload,
|
347
|
+
:headers => { "Accept" => "application/json", "Content-Type" => "application/json" }
|
348
|
+
).to_return(
|
349
|
+
:status => 200,
|
350
|
+
:body => '{"id":"12345"}',
|
351
|
+
:headers => {}
|
352
|
+
)
|
353
|
+
|
354
|
+
stub_request(
|
355
|
+
:head,
|
356
|
+
"https://vra.corp.local/identity/api/tokens/12345"
|
357
|
+
).with(
|
358
|
+
:headers => { "Accept" => "application/json", "Authorization" => "Bearer 12345", "Content-Type" => "application/json" }
|
359
|
+
).to_return(
|
360
|
+
:status => 204,
|
361
|
+
:body => "",
|
362
|
+
:headers => {}
|
363
|
+
)
|
364
|
+
|
365
|
+
stub_request(
|
366
|
+
:get,
|
367
|
+
"https://vra.corp.local/catalog-service/api/consumer/requests/bogus/resourceViews"
|
368
|
+
).with(
|
369
|
+
headers: { "Accept" => "application/json", "Content-Type" => "application/json" }
|
370
|
+
).to_return(
|
371
|
+
status: 200,
|
372
|
+
body: resource_view_body,
|
373
|
+
headers: {}
|
374
|
+
)
|
375
|
+
end
|
376
|
+
|
377
|
+
context "with IP address in the second element" do
|
378
|
+
it "returns the correct IP addresses" do
|
379
|
+
expect(resource.ip_addresses).to eq [ "172.16.20.147" ]
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
context "with IP address in the third element" do
|
384
|
+
let(:resource_view_body) do
|
385
|
+
File.read(File.join(File.dirname(__FILE__),
|
386
|
+
"fixtures",
|
387
|
+
"resource",
|
388
|
+
"ip_address_third_element.txt"))
|
389
|
+
end
|
390
|
+
|
391
|
+
it "returns the correct IP addresses" do
|
392
|
+
expect(resource.ip_addresses).to eq [ "172.16.20.147" ]
|
393
|
+
end
|
333
394
|
end
|
334
395
|
|
335
396
|
it "returns nil if there are no network interfaces" do
|
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.
|
4
|
+
version: 2.6.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-01
|
12
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi-yajl
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- spec/fixtures/catalog_request_template.json
|
176
176
|
- spec/fixtures/resource/catalog_request.json
|
177
177
|
- spec/fixtures/resource/ip_address.txt
|
178
|
+
- spec/fixtures/resource/ip_address_third_element.txt
|
178
179
|
- spec/fixtures/resource/no_ip_address.txt
|
179
180
|
- spec/fixtures/resource/non_vm_resource.json
|
180
181
|
- spec/fixtures/resource/resource_response.json
|
@@ -220,6 +221,7 @@ test_files:
|
|
220
221
|
- spec/fixtures/catalog_request_template.json
|
221
222
|
- spec/fixtures/resource/catalog_request.json
|
222
223
|
- spec/fixtures/resource/ip_address.txt
|
224
|
+
- spec/fixtures/resource/ip_address_third_element.txt
|
223
225
|
- spec/fixtures/resource/no_ip_address.txt
|
224
226
|
- spec/fixtures/resource/non_vm_resource.json
|
225
227
|
- spec/fixtures/resource/resource_response.json
|