vcloud-box-spinner 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG +5 -0
- data/docs/uuids.md +38 -24
- data/lib/provisioner/compute_action/create.rb +16 -9
- data/lib/provisioner/version.rb +1 -1
- metadata +4 -4
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
data/docs/uuids.md
CHANGED
@@ -1,41 +1,55 @@
|
|
1
1
|
# Finding various UUIDs needed by the JSON files
|
2
2
|
|
3
|
-
|
3
|
+
Using: [VCloud Tools](https://github.com/alphagov/vcloudtools)
|
4
4
|
|
5
|
-
* Authorization:
|
6
5
|
|
7
|
-
|
6
|
+
## Logging into VCloud
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
```
|
9
|
+
#$> export VCLOUD_API_ROOT=https://api.vcd.example.com/api eval `vcloud-login`
|
10
|
+
Please log into vCloud
|
11
|
+
Username: username@organisation
|
12
|
+
Password:
|
13
|
+
```
|
11
14
|
|
12
|
-
|
15
|
+
## Finding Catalog and VM Template UUIDs
|
13
16
|
|
14
|
-
* Get org details:
|
15
17
|
|
16
|
-
|
18
|
+
### Finding the organisation uuid
|
19
|
+
|
20
|
+
```
|
21
|
+
#$> vcloud-browse /org | grep MyOrg
|
22
|
+
<Org type="application/vnd.vmware.vcloud.org+xml" name="MyOrg" href="https://api.vcd.example.com/api/org/77595ec2-2391-4817-9257-66b12533d684"/>
|
23
|
+
```
|
17
24
|
|
18
|
-
|
25
|
+
In this example, the Org UUID is `77595ec2-2391-4817-9257-66b12533d684`
|
19
26
|
|
20
|
-
|
27
|
+
### Finding the catalog
|
21
28
|
|
22
|
-
|
29
|
+
```
|
30
|
+
#$> vcloud-browse /org/77595ec2-2391-4817-9257-66b12533d684 | grep vcloud.catalog+xml
|
31
|
+
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Private" href="https://api.vcd.example.com/api/catalog/9250924f-20af-4bcc-9f50-1125a2c15d2c"/>
|
32
|
+
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Public Catalogue" href="https://api.vcd.example.com/api/catalog/b695b0f0-1abf-4562-bd4a-d64cf133888b"/>
|
33
|
+
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Default" href="https://api.vcd.example.com/api/catalog/3af329ef-3371-49d4-aaa0-0b98a03a9255"/>
|
34
|
+
```
|
23
35
|
|
24
|
-
|
36
|
+
This lists three possible catalogs, Private, Default and Public Catalogue (yours may be named differently, or you may have a different number of them.)
|
25
37
|
|
26
|
-
|
38
|
+
In the next example, we will use the UUID of the "Public Catalogue" which is `b695b0f0-1abf-4562-bd4a-d64cf133888b`
|
27
39
|
|
28
|
-
|
40
|
+
### Finding Templates within a Catalog
|
29
41
|
|
42
|
+
```
|
43
|
+
[/Users/ssharpe]$ vcloud-browse /catalog/b695b0f0-1abf-4562-bd4a-d64cf133888b | grep catalogItem+xml
|
44
|
+
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu 12.04 Desktop" href="https://api.vcd.example.com/api/catalogItem/4e376bed-5d4c-4748-9d0d-1469b24f31c0"/>
|
45
|
+
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu 12.04 Server" href="https://api.vcd.example.com/api/catalogItem/4887d502-5873-4d0c-bb63-075792277ec6"/>
|
46
|
+
```
|
30
47
|
|
31
|
-
## Network
|
48
|
+
## Finding Network UUIDs
|
32
49
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
- The above returns network details, choose the one you need on basis of name
|
40
|
-
|
41
|
-
<Link rel="down" type="application/vnd.vmware.vcloud.orgNetwork+xml" name="{network-name}" href="https://vendor-api-endpoint/api/network/{network-uuid}"/>
|
50
|
+
```
|
51
|
+
#$> vcloud-browse /org/0e665418-a3d5-4363-aec0-f2da5ab399d9 | grep orgNetwork
|
52
|
+
<Link rel="down" type="application/vnd.vmware.vcloud.orgNetwork+xml" name="Net1" href="https://api.vcd.example.com/api/network/e22af121-cdaf-455b-b840-1d7283aaeca7"/>
|
53
|
+
<Link rel="down" type="application/vnd.vmware.vcloud.orgNetwork+xml" name="Net2" href="https://api.vcd.example.com/api/network/59defffb-f6b7-47b8-a82c-80a8bc3fc76b"/>
|
54
|
+
<Link rel="down" type="application/vnd.vmware.vcloud.orgNetwork+xml" name="Net3" href="https://api.vcd.example.com/api/network/91ae3fdb-e354-426c-be79-4911f7c5dbdb"/>
|
55
|
+
```
|
@@ -51,6 +51,7 @@ module Provisioner
|
|
51
51
|
guest_customization_section = customization_options[:GuestCustomizationSection]
|
52
52
|
|
53
53
|
response = modify_xml(guest_customization_section[:href], guest_customization_section[:type]) do |xml|
|
54
|
+
xml.at_css('Enabled').content = 'true'
|
54
55
|
xml.at_css('ComputerName').content = options[:vm_name]
|
55
56
|
if xml.at_css('CustomizationScript').nil?
|
56
57
|
xml.at_css('ComputerName').before("<CustomizationScript>#{CGI.escapeHTML(user_data)}</CustomizationScript>\n")
|
@@ -127,15 +128,8 @@ module Provisioner
|
|
127
128
|
end
|
128
129
|
private :update_network_connection_options
|
129
130
|
|
130
|
-
def power_on(server)
|
131
|
-
connection = compute.servers.service
|
132
|
-
power_on_uri = server.links.find {|link| link[:rel] == 'power:powerOn' }[:href]
|
133
|
-
connection.request(:uri => power_on_uri, :method => "POST", :expects => 202)
|
134
|
-
end
|
135
|
-
private :power_on
|
136
|
-
|
137
131
|
def wait_for_vms_to_appear(server, options)
|
138
|
-
|
132
|
+
180.times.each do |x|
|
139
133
|
logger.debug("waiting for vm to spin up...")
|
140
134
|
if server.attributes[:children] && server.attributes[:children][:href]
|
141
135
|
return
|
@@ -149,17 +143,30 @@ module Provisioner
|
|
149
143
|
end
|
150
144
|
private :wait_for_vms_to_appear
|
151
145
|
|
146
|
+
def wait_for_vmware_tools(server)
|
147
|
+
logger.debug("cycling power to identify VMware Tools...")
|
148
|
+
|
149
|
+
server.power_on
|
150
|
+
server.wait_for { server.ready? }
|
151
|
+
server.wait_for(90) { attributes[:children][:RuntimeInfoSection][:VMWareTools] }
|
152
|
+
|
153
|
+
server.undeploy
|
154
|
+
server.wait_for { server.ready? }
|
155
|
+
end
|
156
|
+
|
152
157
|
def launch_server name
|
153
158
|
super
|
154
159
|
server = provision(name, options)
|
155
160
|
|
156
161
|
wait_for_vms_to_appear(server, options)
|
162
|
+
wait_for_vmware_tools(server)
|
157
163
|
|
158
164
|
update_guest_customization_options(server, options)
|
159
165
|
update_network_connection_options(server, options)
|
160
166
|
update_machine_resources(server, options)
|
161
167
|
|
162
|
-
power_on
|
168
|
+
server.power_on
|
169
|
+
server.wait_for { server.ready? }
|
163
170
|
|
164
171
|
server
|
165
172
|
end
|
data/lib/provisioner/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: vcloud-box-spinner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Garima Singh
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-09-04 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -189,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
189
|
requirements:
|
190
190
|
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
hash:
|
192
|
+
hash: 2958339827570531793
|
193
193
|
segments:
|
194
194
|
- 0
|
195
195
|
version: "0"
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
199
199
|
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
hash:
|
201
|
+
hash: 2958339827570531793
|
202
202
|
segments:
|
203
203
|
- 0
|
204
204
|
version: "0"
|