vagrant-vcloud 0.4.0 → 0.4.1
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/README.md +10 -1
- data/lib/vagrant-vcloud/action.rb +1 -0
- data/lib/vagrant-vcloud/driver/base.rb +27 -10
- data/lib/vagrant-vcloud/driver/meta.rb +8 -8
- data/lib/vagrant-vcloud/driver/version_5_1.rb +102 -73
- data/lib/vagrant-vcloud/errors.rb +9 -7
- data/lib/vagrant-vcloud/version.rb +1 -1
- data/locales/en.yml +3 -2
- 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: e1c0bf0f48d1c3e7bd352126b15f4a938ca0fc08
|
4
|
+
data.tar.gz: af36799b2352b3eeb67a302ef468c5868be973ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 728cc1f80d48c88fd71be8a1d0ff933c91e48d056409a7fcc70355f59b313af7667c298397d7d7accfc90a74a78bc522c9cfc08ead7c7877de90696deb831349
|
7
|
+
data.tar.gz: 3600a3156cccad0832c40da6c59e8c0a271887aa2070051e6110c3afab8f1af9ee97c98863a32d4ceb75f08d61f8dd51515ff66fc003c5d498135a24772074e5
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
[Vagrant](http://www.vagrantup.com) provider for VMware vCloud Director®
|
2
2
|
=============
|
3
3
|
|
4
|
-
[Version 0.4.
|
4
|
+
[Version 0.4.1](../../releases/tag/v0.4.1) has been released!
|
5
5
|
-------------
|
6
6
|
|
7
7
|
Please note that this software is still Alpha/Beta quality and is not recommended for production usage.
|
@@ -23,6 +23,15 @@ Vagrant will download all the required gems during the installation process.
|
|
23
23
|
|
24
24
|
After the install has completed a ```vagrant up --provider=vcloud``` will trigger the newly installed provider.
|
25
25
|
|
26
|
+
Upgrade
|
27
|
+
-------------
|
28
|
+
|
29
|
+
If you already have vagrant-vcloud installed you can update to the latest version available by issuing:
|
30
|
+
|
31
|
+
```vagrant plugin update vagrant-vcloud```
|
32
|
+
|
33
|
+
Vagrant will take care of the upgrade process.
|
34
|
+
|
26
35
|
Configuration
|
27
36
|
-------------
|
28
37
|
|
@@ -297,7 +297,7 @@ module VagrantPlugins
|
|
297
297
|
extheader = {}
|
298
298
|
extheader['accept'] = "application/*+xml;version=#{@api_version}"
|
299
299
|
|
300
|
-
|
300
|
+
unless content_type.nil?
|
301
301
|
extheader['Content-Type'] = content_type
|
302
302
|
end
|
303
303
|
|
@@ -331,9 +331,16 @@ module VagrantPlugins
|
|
331
331
|
extheader
|
332
332
|
)
|
333
333
|
|
334
|
-
|
335
|
-
|
336
|
-
|
334
|
+
unless response.ok?
|
335
|
+
if response.code == 400
|
336
|
+
error_message = Nokogiri.parse(response.body)
|
337
|
+
error = error_message.css('Error')
|
338
|
+
fail Errors::InvalidRequestError,
|
339
|
+
:message => error.first['message'].to_s
|
340
|
+
else
|
341
|
+
fail Errors::UnattendedCodeError,
|
342
|
+
:message => response.status
|
343
|
+
end
|
337
344
|
end
|
338
345
|
|
339
346
|
nicexml = Nokogiri.XML(response.body)
|
@@ -343,7 +350,7 @@ module VagrantPlugins
|
|
343
350
|
if @logger.level == 1
|
344
351
|
ap "[#{Time.now.ctime}] <- RECV #{response.status}"
|
345
352
|
# Just avoid the task spam.
|
346
|
-
|
353
|
+
unless url.index('/task/')
|
347
354
|
ap 'RECV HEADERS'
|
348
355
|
ap response.headers
|
349
356
|
ap 'RECV BODY'
|
@@ -352,10 +359,8 @@ module VagrantPlugins
|
|
352
359
|
end
|
353
360
|
|
354
361
|
[Nokogiri.parse(response.body), response.headers]
|
355
|
-
rescue SocketError
|
356
|
-
raise
|
357
|
-
rescue Errno::EADDRNOTAVAIL
|
358
|
-
raise 'Impossible to connect, verify endpoint'
|
362
|
+
rescue SocketError, Errno::EADDRNOTAVAIL
|
363
|
+
raise Errors::EndpointUnavailable, :endpoint => @api_url
|
359
364
|
end
|
360
365
|
end
|
361
366
|
|
@@ -432,8 +437,20 @@ module VagrantPlugins
|
|
432
437
|
'Content-Length' => range_len.to_s
|
433
438
|
}
|
434
439
|
|
440
|
+
upload_request = "#{@host_url}#{upload_url}"
|
441
|
+
|
442
|
+
# Massive debug when LOG=DEBUG
|
443
|
+
# Using awesome_print to get nice XML output for better readability
|
444
|
+
if @logger.level == 1
|
445
|
+
ap "[#{Time.now.ctime}] -> SEND PUT #{upload_request}"
|
446
|
+
ap 'SEND HEADERS'
|
447
|
+
ap extheader
|
448
|
+
ap 'SEND BODY'
|
449
|
+
ap '<data omitted>'
|
450
|
+
end
|
451
|
+
|
435
452
|
begin
|
436
|
-
|
453
|
+
|
437
454
|
# FIXME: Add debug on the return status of "connection"
|
438
455
|
# to enhance troubleshooting for this upload process.
|
439
456
|
# (tsugliani)
|
@@ -129,13 +129,14 @@ module VagrantPlugins
|
|
129
129
|
# Suppress SSL depth message
|
130
130
|
clnt.ssl_config.verify_callback = proc { |ok, ctx|; true }
|
131
131
|
|
132
|
-
|
132
|
+
uri = URI(host_url)
|
133
|
+
url = "#{uri.scheme}://#{uri.host}:#{uri.port}/api/versions"
|
133
134
|
|
134
135
|
begin
|
135
136
|
response = clnt.request('GET', url, nil, nil, nil)
|
136
|
-
|
137
|
-
|
138
|
-
|
137
|
+
unless response.ok?
|
138
|
+
fail Errors::UnattendedCodeError,
|
139
|
+
:message => response.status + ' ' + response.reason
|
139
140
|
end
|
140
141
|
|
141
142
|
version_info = Nokogiri.parse(response.body)
|
@@ -154,10 +155,9 @@ module VagrantPlugins
|
|
154
155
|
|
155
156
|
api_version_supported
|
156
157
|
|
157
|
-
rescue SocketError
|
158
|
-
raise Errors::
|
159
|
-
|
160
|
-
raise Errors::HostNotFound, :message => host_url
|
158
|
+
rescue SocketError, Errno::EADDRNOTAVAIL
|
159
|
+
raise Errors::EndpointUnavailable,
|
160
|
+
:endpoint => "#{uri.scheme}://#{uri.host}:#{uri.port}/api"
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
@@ -18,6 +18,7 @@
|
|
18
18
|
require 'ruby-progressbar'
|
19
19
|
require 'set'
|
20
20
|
require 'netaddr'
|
21
|
+
require 'uri'
|
21
22
|
|
22
23
|
module VagrantPlugins
|
23
24
|
module VCloud
|
@@ -28,17 +29,17 @@ module VagrantPlugins
|
|
28
29
|
|
29
30
|
##
|
30
31
|
# Init the driver with the Vagrantfile information
|
31
|
-
def initialize(
|
32
|
+
def initialize(hostname, username, password, org_name)
|
32
33
|
@logger = Log4r::Logger.new('vagrant::provider::vcloud::driver_5_1')
|
33
|
-
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@host_url = "#{host}"
|
34
|
+
uri = URI(hostname)
|
35
|
+
@api_url = "#{uri.scheme}://#{uri.host}:#{uri.port}/api"
|
36
|
+
@host_url = "#{uri.scheme}://#{uri.host}:#{uri.port}"
|
37
37
|
@username = username
|
38
38
|
@password = password
|
39
39
|
@org_name = org_name
|
40
40
|
@api_version = '5.1'
|
41
41
|
@id = nil
|
42
|
+
|
42
43
|
@cached_vapp_edge_public_ips = {}
|
43
44
|
end
|
44
45
|
|
@@ -86,7 +87,7 @@ module VagrantPlugins
|
|
86
87
|
|
87
88
|
results = {}
|
88
89
|
orgs.each do |org|
|
89
|
-
results[org['name']] = org['href'].gsub(
|
90
|
+
results[org['name']] = URI(org['href']).path.gsub('/api/org/', '')
|
90
91
|
end
|
91
92
|
results
|
92
93
|
end
|
@@ -142,8 +143,8 @@ module VagrantPlugins
|
|
142
143
|
response.css(
|
143
144
|
"Link[type='application/vnd.vmware.vcloud.catalog+xml']"
|
144
145
|
).each do |item|
|
145
|
-
catalogs[item['name']] = item['href'].gsub(
|
146
|
-
|
146
|
+
catalogs[item['name']] = URI(item['href']).path.gsub(
|
147
|
+
'/api/catalog/', ''
|
147
148
|
)
|
148
149
|
end
|
149
150
|
|
@@ -151,8 +152,8 @@ module VagrantPlugins
|
|
151
152
|
response.css(
|
152
153
|
"Link[type='application/vnd.vmware.vcloud.vdc+xml']"
|
153
154
|
).each do |item|
|
154
|
-
vdcs[item['name']] = item['href'].gsub(
|
155
|
-
|
155
|
+
vdcs[item['name']] = URI(item['href']).path.gsub(
|
156
|
+
'/api/vdc/', ''
|
156
157
|
)
|
157
158
|
end
|
158
159
|
|
@@ -160,8 +161,8 @@ module VagrantPlugins
|
|
160
161
|
response.css(
|
161
162
|
"Link[type='application/vnd.vmware.vcloud.orgNetwork+xml']"
|
162
163
|
).each do |item|
|
163
|
-
networks[item['name']] = item['href'].gsub(
|
164
|
-
|
164
|
+
networks[item['name']] = URI(item['href']).path.gsub(
|
165
|
+
'/api/network/', ''
|
165
166
|
)
|
166
167
|
end
|
167
168
|
|
@@ -169,8 +170,8 @@ module VagrantPlugins
|
|
169
170
|
response.css(
|
170
171
|
"Link[type='application/vnd.vmware.vcloud.tasksList+xml']"
|
171
172
|
).each do |item|
|
172
|
-
tasklists[item['name']] = item['href'].gsub(
|
173
|
-
|
173
|
+
tasklists[item['name']] = URI(item['href']).path.gsub(
|
174
|
+
'/api/tasksList/', ''
|
174
175
|
)
|
175
176
|
end
|
176
177
|
|
@@ -198,8 +199,8 @@ module VagrantPlugins
|
|
198
199
|
response.css(
|
199
200
|
"CatalogItem[type='application/vnd.vmware.vcloud.catalogItem+xml']"
|
200
201
|
).each do |item|
|
201
|
-
items[item['name']] = item['href'].gsub(
|
202
|
-
|
202
|
+
items[item['name']] = URI(item['href']).path.gsub(
|
203
|
+
'/api/catalogItem/', ''
|
203
204
|
)
|
204
205
|
end
|
205
206
|
{ :description => description, :items => items }
|
@@ -218,6 +219,34 @@ module VagrantPlugins
|
|
218
219
|
end
|
219
220
|
end
|
220
221
|
|
222
|
+
if result.nil?
|
223
|
+
# catalog not found, search in global catalogs as well
|
224
|
+
# that are not listed in organization directly
|
225
|
+
params = {
|
226
|
+
'method' => :get,
|
227
|
+
'command' => '/catalogs/query/',
|
228
|
+
'cacheable' => true
|
229
|
+
}
|
230
|
+
|
231
|
+
response, _headers = send_request(params)
|
232
|
+
|
233
|
+
catalogs = {}
|
234
|
+
response.css(
|
235
|
+
'CatalogRecord'
|
236
|
+
).each do |item|
|
237
|
+
catalogs[item['name']] = URI(item['href']).path.gsub(
|
238
|
+
'/api/catalog/', ''
|
239
|
+
)
|
240
|
+
end
|
241
|
+
|
242
|
+
catalogs.each do |catalog|
|
243
|
+
if catalog[0].downcase == catalog_name.downcase
|
244
|
+
result = catalog[1]
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
221
250
|
result
|
222
251
|
end
|
223
252
|
|
@@ -256,8 +285,8 @@ module VagrantPlugins
|
|
256
285
|
response.css(
|
257
286
|
"ResourceEntity[type='application/vnd.vmware.vcloud.vApp+xml']"
|
258
287
|
).each do |item|
|
259
|
-
vapps[item['name']] = item['href'].gsub(
|
260
|
-
|
288
|
+
vapps[item['name']] = URI(item['href']).path.gsub(
|
289
|
+
'/api/vApp/vapp-', ''
|
261
290
|
)
|
262
291
|
end
|
263
292
|
|
@@ -265,8 +294,8 @@ module VagrantPlugins
|
|
265
294
|
response.css(
|
266
295
|
"Network[type='application/vnd.vmware.vcloud.network+xml']"
|
267
296
|
).each do |item|
|
268
|
-
networks[item['name']] = item['href'].gsub(
|
269
|
-
|
297
|
+
networks[item['name']] = URI(item['href']).path.gsub(
|
298
|
+
'/api/network/', ''
|
270
299
|
)
|
271
300
|
end
|
272
301
|
{
|
@@ -324,8 +353,8 @@ module VagrantPlugins
|
|
324
353
|
response.css(
|
325
354
|
"Entity[type='application/vnd.vmware.vcloud.vAppTemplate+xml']"
|
326
355
|
).each do |item|
|
327
|
-
items[item['name']] = item['href'].gsub(
|
328
|
-
|
356
|
+
items[item['name']] = URI(item['href']).path.gsub(
|
357
|
+
'/api/vAppTemplate/vappTemplate-', ''
|
329
358
|
)
|
330
359
|
end
|
331
360
|
{ :description => description, :items => items }
|
@@ -359,7 +388,9 @@ module VagrantPlugins
|
|
359
388
|
vms_hash = {}
|
360
389
|
response.css('/VAppTemplate/Children/Vm').each do |vm_elem|
|
361
390
|
vm_name = vm_elem['name']
|
362
|
-
vm_id = vm_elem['href'].gsub(
|
391
|
+
vm_id = URI(vm_elem['href']).path.gsub(
|
392
|
+
'/api/vAppTemplate/vm-', ''
|
393
|
+
)
|
363
394
|
|
364
395
|
# Add the VM name/id to the VMs Hash
|
365
396
|
vms_hash[vm_name] = { :id => vm_id }
|
@@ -415,7 +446,7 @@ module VagrantPlugins
|
|
415
446
|
vms_hash[vm['name'].to_sym] = {
|
416
447
|
:addresses => addresses,
|
417
448
|
:status => convert_vapp_status(vm['status']),
|
418
|
-
:id => vm['href'].gsub(
|
449
|
+
:id => URI(vm['href']).path.gsub('/api/vApp/vm-', ''),
|
419
450
|
:vapp_scoped_local_id => vapp_local_id.text
|
420
451
|
}
|
421
452
|
end
|
@@ -440,7 +471,7 @@ module VagrantPlugins
|
|
440
471
|
}
|
441
472
|
|
442
473
|
_response, headers = send_request(params)
|
443
|
-
task_id = headers['Location'].gsub(
|
474
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
444
475
|
task_id
|
445
476
|
end
|
446
477
|
|
@@ -463,7 +494,7 @@ module VagrantPlugins
|
|
463
494
|
builder.to_xml,
|
464
495
|
'application/vnd.vmware.vcloud.undeployVAppParams+xml'
|
465
496
|
)
|
466
|
-
task_id = headers['Location'].gsub(
|
497
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
467
498
|
task_id
|
468
499
|
end
|
469
500
|
|
@@ -476,7 +507,7 @@ module VagrantPlugins
|
|
476
507
|
}
|
477
508
|
|
478
509
|
_response, headers = send_request(params)
|
479
|
-
task_id = headers['Location'].gsub(
|
510
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
480
511
|
task_id
|
481
512
|
end
|
482
513
|
|
@@ -492,7 +523,7 @@ module VagrantPlugins
|
|
492
523
|
}
|
493
524
|
|
494
525
|
_response, headers = send_request(params)
|
495
|
-
task_id = headers['Location'].gsub(
|
526
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
496
527
|
task_id
|
497
528
|
end
|
498
529
|
|
@@ -507,7 +538,7 @@ module VagrantPlugins
|
|
507
538
|
}
|
508
539
|
|
509
540
|
_response, headers = send_request(params)
|
510
|
-
task_id = headers['Location'].gsub(
|
541
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
511
542
|
task_id
|
512
543
|
end
|
513
544
|
|
@@ -520,7 +551,7 @@ module VagrantPlugins
|
|
520
551
|
}
|
521
552
|
|
522
553
|
_response, headers = send_request(params)
|
523
|
-
task_id = headers['Location'].gsub(
|
554
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
524
555
|
task_id
|
525
556
|
end
|
526
557
|
|
@@ -535,7 +566,7 @@ module VagrantPlugins
|
|
535
566
|
}
|
536
567
|
|
537
568
|
_response, headers = send_request(params)
|
538
|
-
task_id = headers['Location'].gsub(
|
569
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
539
570
|
task_id
|
540
571
|
end
|
541
572
|
|
@@ -560,7 +591,7 @@ module VagrantPlugins
|
|
560
591
|
builder.to_xml,
|
561
592
|
'application/vnd.vmware.vcloud.undeployVAppParams+xml'
|
562
593
|
)
|
563
|
-
task_id = headers['Location'].gsub(
|
594
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
564
595
|
task_id
|
565
596
|
end
|
566
597
|
|
@@ -583,7 +614,7 @@ module VagrantPlugins
|
|
583
614
|
builder.to_xml,
|
584
615
|
'application/vnd.vmware.vcloud.undeployVAppParams+xml'
|
585
616
|
)
|
586
|
-
task_id = headers['Location'].gsub(
|
617
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
587
618
|
task_id
|
588
619
|
end
|
589
620
|
|
@@ -599,7 +630,7 @@ module VagrantPlugins
|
|
599
630
|
}
|
600
631
|
|
601
632
|
_response, headers = send_request(params)
|
602
|
-
task_id = headers['Location'].gsub(
|
633
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
603
634
|
task_id
|
604
635
|
end
|
605
636
|
|
@@ -614,7 +645,7 @@ module VagrantPlugins
|
|
614
645
|
}
|
615
646
|
|
616
647
|
_response, headers = send_request(params)
|
617
|
-
task_id = headers['Location'].gsub(
|
648
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
618
649
|
task_id
|
619
650
|
end
|
620
651
|
|
@@ -627,7 +658,7 @@ module VagrantPlugins
|
|
627
658
|
}
|
628
659
|
|
629
660
|
_response, headers = send_request(params)
|
630
|
-
task_id = headers['Location'].gsub(
|
661
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
631
662
|
task_id
|
632
663
|
end
|
633
664
|
|
@@ -652,13 +683,13 @@ module VagrantPlugins
|
|
652
683
|
builder.to_xml,
|
653
684
|
'application/vnd.vmware.admin.catalog+xml'
|
654
685
|
)
|
655
|
-
task_id = response.css(
|
656
|
-
|
657
|
-
|
686
|
+
task_id = URI(response.css(
|
687
|
+
"AdminCatalog Tasks Task[operationName='catalogCreateCatalog']"
|
688
|
+
).first[:href]).path.gsub('/api/task/', '')
|
658
689
|
|
659
|
-
catalog_id = response.css(
|
660
|
-
|
661
|
-
).first[:href].gsub(
|
690
|
+
catalog_id = URI(response.css(
|
691
|
+
"AdminCatalog Link [type='application/vnd.vmware.vcloud.catalog+xml']"
|
692
|
+
).first[:href]).path.gsub('/api/catalog/', '')
|
662
693
|
|
663
694
|
{ :task_id => task_id, :catalog_id => catalog_id }
|
664
695
|
end
|
@@ -697,13 +728,13 @@ module VagrantPlugins
|
|
697
728
|
'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml'
|
698
729
|
)
|
699
730
|
|
700
|
-
vapp_id = headers['Location'].gsub(
|
731
|
+
vapp_id = URI(headers['Location']).path.gsub('/api/vApp/vapp-', '')
|
701
732
|
|
702
733
|
task = response.css(
|
703
734
|
"VApp Task[operationName='vdcInstantiateVapp']"
|
704
735
|
).first
|
705
736
|
|
706
|
-
task_id = task['href'].gsub("
|
737
|
+
task_id = URI(task['href']).path.gsub("/api/task/", '')
|
707
738
|
|
708
739
|
{ :vapp_id => vapp_id, :task_id => task_id }
|
709
740
|
end
|
@@ -802,10 +833,10 @@ module VagrantPlugins
|
|
802
833
|
'application/vnd.vmware.vcloud.composeVAppParams+xml'
|
803
834
|
)
|
804
835
|
|
805
|
-
vapp_id = headers['Location'].gsub("
|
836
|
+
vapp_id = URI(headers['Location']).path.gsub("/api/vApp/vapp-", '')
|
806
837
|
|
807
838
|
task = response.css("VApp Task[operationName='vdcComposeVapp']").first
|
808
|
-
task_id = task['href'].gsub(
|
839
|
+
task_id = URI(task['href']).path.gsub('/api/task/', '')
|
809
840
|
|
810
841
|
{ :vapp_id => vapp_id, :task_id => task_id }
|
811
842
|
end
|
@@ -865,10 +896,10 @@ module VagrantPlugins
|
|
865
896
|
'application/vnd.vmware.vcloud.recomposeVAppParams+xml'
|
866
897
|
)
|
867
898
|
|
868
|
-
vapp_id = headers['Location'].gsub(
|
899
|
+
vapp_id = URI(headers['Location']).path.gsub('/api/vApp/vapp-', '')
|
869
900
|
|
870
901
|
task = response.css("Task [operationName='vdcRecomposeVapp']").first
|
871
|
-
task_id = task['href'].gsub(
|
902
|
+
task_id = URI(task['href']).path.gsub('/api/task/', '')
|
872
903
|
|
873
904
|
{ :vapp_id => vapp_id, :task_id => task_id }
|
874
905
|
end
|
@@ -904,7 +935,7 @@ module VagrantPlugins
|
|
904
935
|
|
905
936
|
vms.each do |vm|
|
906
937
|
vms_hash[vm['name']] = {
|
907
|
-
:id => vm['href'].gsub(
|
938
|
+
:id => URI(vm['href']).path.gsub('/api/vAppTemplate/vm-', '')
|
908
939
|
}
|
909
940
|
end
|
910
941
|
|
@@ -962,7 +993,7 @@ module VagrantPlugins
|
|
962
993
|
'application/vnd.vmware.vcloud.networkConfigSection+xml'
|
963
994
|
)
|
964
995
|
|
965
|
-
task_id = headers['Location'].gsub("
|
996
|
+
task_id = URI(headers['Location']).path.gsub("/api/task/", '')
|
966
997
|
task_id
|
967
998
|
end
|
968
999
|
|
@@ -1029,7 +1060,7 @@ module VagrantPlugins
|
|
1029
1060
|
'application/vnd.vmware.vcloud.networkConfigSection+xml'
|
1030
1061
|
)
|
1031
1062
|
|
1032
|
-
task_id = headers['Location'].gsub(
|
1063
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1033
1064
|
task_id
|
1034
1065
|
end
|
1035
1066
|
##
|
@@ -1099,8 +1130,8 @@ module VagrantPlugins
|
|
1099
1130
|
edge_gateway = response.css('EdgeGatewayRecord').first
|
1100
1131
|
|
1101
1132
|
if edge_gateway
|
1102
|
-
return edge_gateway['href'].gsub(
|
1103
|
-
|
1133
|
+
return URI(edge_gateway['href']).path.gsub(
|
1134
|
+
'/api/admin/edgeGateway/', ''
|
1104
1135
|
)
|
1105
1136
|
else
|
1106
1137
|
return nil
|
@@ -1119,7 +1150,7 @@ module VagrantPlugins
|
|
1119
1150
|
}
|
1120
1151
|
|
1121
1152
|
_response, headers = send_request(params)
|
1122
|
-
task_id = headers['Location'].gsub(
|
1153
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1123
1154
|
task_id
|
1124
1155
|
end
|
1125
1156
|
|
@@ -1145,8 +1176,8 @@ module VagrantPlugins
|
|
1145
1176
|
edge_gateway = response.css('EdgeGatewayRecord').first
|
1146
1177
|
|
1147
1178
|
if edge_gateway
|
1148
|
-
edge_gateway_id = edge_gateway['href'].gsub(
|
1149
|
-
|
1179
|
+
edge_gateway_id = URI(edge_gateway['href']).path.gsub(
|
1180
|
+
'/api/admin/edgeGateway/', ''
|
1150
1181
|
)
|
1151
1182
|
end
|
1152
1183
|
|
@@ -1312,7 +1343,7 @@ module VagrantPlugins
|
|
1312
1343
|
'application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml'
|
1313
1344
|
)
|
1314
1345
|
|
1315
|
-
task_id = headers['Location'].gsub(
|
1346
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1316
1347
|
task_id
|
1317
1348
|
end
|
1318
1349
|
|
@@ -1450,7 +1481,7 @@ module VagrantPlugins
|
|
1450
1481
|
'application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml'
|
1451
1482
|
)
|
1452
1483
|
|
1453
|
-
task_id = headers['Location'].gsub(
|
1484
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1454
1485
|
task_id
|
1455
1486
|
end
|
1456
1487
|
|
@@ -1545,14 +1576,14 @@ module VagrantPlugins
|
|
1545
1576
|
)
|
1546
1577
|
|
1547
1578
|
# Get vAppTemplate Link from location
|
1548
|
-
vapp_template = headers['Location'].gsub(
|
1549
|
-
|
1579
|
+
vapp_template = URI(headers['Location']).path.gsub(
|
1580
|
+
'/api/vAppTemplate/vappTemplate-', ''
|
1550
1581
|
)
|
1551
1582
|
|
1552
1583
|
@logger.debug("Getting vAppTemplate ID: #{vapp_template}")
|
1553
|
-
descriptor_upload = response.css(
|
1584
|
+
descriptor_upload = URI(response.css(
|
1554
1585
|
"Files Link [rel='upload:default']"
|
1555
|
-
).first[:href].gsub(
|
1586
|
+
).first[:href]).path.gsub('/transfer/', '')
|
1556
1587
|
transfer_guid = descriptor_upload.gsub('/descriptor.ovf', '')
|
1557
1588
|
|
1558
1589
|
ovf_file_basename = File.basename(ovf_file, '.ovf')
|
@@ -1581,7 +1612,7 @@ module VagrantPlugins
|
|
1581
1612
|
task = response.css(
|
1582
1613
|
"VAppTemplate Task[operationName='vdcUploadOvfContents']"
|
1583
1614
|
).first
|
1584
|
-
task_id = task['href'].gsub(
|
1615
|
+
task_id = URI(task['href']).path.gsub('/api/task/', '')
|
1585
1616
|
|
1586
1617
|
# Loop to wait for the upload links to show up in the vAppTemplate
|
1587
1618
|
# we just created
|
@@ -1616,9 +1647,7 @@ module VagrantPlugins
|
|
1616
1647
|
response.css(
|
1617
1648
|
"Files File [bytesTransferred='0'] Link [rel='upload:default']"
|
1618
1649
|
).each do |file|
|
1619
|
-
file_name = file[:href].gsub(
|
1620
|
-
"#{@host_url}/transfer/#{transfer_guid}/", ''
|
1621
|
-
)
|
1650
|
+
file_name = URI(file[:href]).path.gsub("/transfer/#{transfer_guid}/", '')
|
1622
1651
|
upload_filename = "#{ovf_dir}/#{file_name}"
|
1623
1652
|
upload_url = "/transfer/#{transfer_guid}/#{file_name}"
|
1624
1653
|
upload_file(
|
@@ -1670,9 +1699,9 @@ module VagrantPlugins
|
|
1670
1699
|
response, _headers = send_request(params)
|
1671
1700
|
|
1672
1701
|
# Cancel Task
|
1673
|
-
cancel_hook = response.css(
|
1702
|
+
cancel_hook = URI(response.css(
|
1674
1703
|
"Tasks Task Link [rel='task:cancel']"
|
1675
|
-
).first[:href].gsub(
|
1704
|
+
).first[:href]).path.gsub('/api', '')
|
1676
1705
|
|
1677
1706
|
params = {
|
1678
1707
|
'method' => :post,
|
@@ -1769,7 +1798,7 @@ module VagrantPlugins
|
|
1769
1798
|
'application/vnd.vmware.vcloud.networkConfigSection+xml'
|
1770
1799
|
)
|
1771
1800
|
|
1772
|
-
task_id = headers['Location'].gsub(
|
1801
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1773
1802
|
task_id
|
1774
1803
|
end
|
1775
1804
|
|
@@ -1805,7 +1834,7 @@ module VagrantPlugins
|
|
1805
1834
|
'application/vnd.vmware.vcloud.networkConnectionSection+xml'
|
1806
1835
|
)
|
1807
1836
|
|
1808
|
-
task_id = headers['Location'].gsub(
|
1837
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1809
1838
|
task_id
|
1810
1839
|
end
|
1811
1840
|
|
@@ -1834,7 +1863,7 @@ module VagrantPlugins
|
|
1834
1863
|
builder.to_xml,
|
1835
1864
|
'application/vnd.vmware.vcloud.guestCustomizationSection+xml'
|
1836
1865
|
)
|
1837
|
-
task_id = headers['Location'].gsub(
|
1866
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1838
1867
|
task_id
|
1839
1868
|
end
|
1840
1869
|
|
@@ -1847,7 +1876,7 @@ module VagrantPlugins
|
|
1847
1876
|
}
|
1848
1877
|
|
1849
1878
|
_response, headers = send_request(params)
|
1850
|
-
task_id = headers['Location'].gsub(
|
1879
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1851
1880
|
task_id
|
1852
1881
|
end
|
1853
1882
|
|
@@ -1898,7 +1927,7 @@ module VagrantPlugins
|
|
1898
1927
|
'application/vnd.vmware.vcloud.virtualhardwaresection+xml'
|
1899
1928
|
)
|
1900
1929
|
|
1901
|
-
task_id = headers['Location'].gsub(
|
1930
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
1902
1931
|
task_id
|
1903
1932
|
else
|
1904
1933
|
return nil
|
@@ -9,7 +9,6 @@ module VagrantPlugins
|
|
9
9
|
class RsyncError < VCloudError
|
10
10
|
error_key(:rsync_error)
|
11
11
|
end
|
12
|
-
|
13
12
|
class MkdirError < VCloudError
|
14
13
|
error_key(:mkdir_error)
|
15
14
|
end
|
@@ -19,12 +18,6 @@ module VagrantPlugins
|
|
19
18
|
class CatalogAddError < VCloudError
|
20
19
|
error_key(:catalog_add_error)
|
21
20
|
end
|
22
|
-
class HostNotFound < VCloudError
|
23
|
-
error_key(:host_not_found)
|
24
|
-
end
|
25
|
-
class HostRedirect < VCloudError
|
26
|
-
error_key(:host_redirect)
|
27
|
-
end
|
28
21
|
class UnauthorizedAccess < VCloudError
|
29
22
|
error_key(:unauthorized_access)
|
30
23
|
end
|
@@ -61,6 +54,15 @@ module VagrantPlugins
|
|
61
54
|
class InvalidStateError < RestError
|
62
55
|
error_key(:invalid_state_error)
|
63
56
|
end
|
57
|
+
class InvalidRequestError < RestError
|
58
|
+
error_key(:invalid_request_error)
|
59
|
+
end
|
60
|
+
class UnattendedCodeError < RestError
|
61
|
+
error_key(:unattended_code_error)
|
62
|
+
end
|
63
|
+
class EndpointUnavailable < RestError
|
64
|
+
error_key(:endpoint_unavailable)
|
65
|
+
end
|
64
66
|
class SyncError < VCloudError
|
65
67
|
error_key(:sync_error)
|
66
68
|
end
|
data/locales/en.yml
CHANGED
@@ -30,8 +30,6 @@ en:
|
|
30
30
|
missing_resource_pool: "Configured resource pool not found"
|
31
31
|
missing_template: "Configured template VM could not be found"
|
32
32
|
vcloud_old_version: "Sorry, VMware vCloud Director API version %{version} is not supported"
|
33
|
-
host_not_found: "VMware vCloud Endpoint not found: %{message}"
|
34
|
-
host_redirect: "VMware vCloud Endpoint not found, received an HTTP 302 message back, are you sure you're using the right protocol? (https)"
|
35
33
|
unauthorized_access: "Access not authorized, please verify the username and password in your Vagrantfile"
|
36
34
|
catalog_add_error: "Impossible to add Box to Catalog, error: %{message}"
|
37
35
|
invalid_network_specification: "Wrong Network specification in the Vagrantfile, make sure you have access to the specified network."
|
@@ -42,6 +40,9 @@ en:
|
|
42
40
|
object_not_found: "Object not found in vCloud Director"
|
43
41
|
invalid_config_error: "Invalid Guest Customization Specified"
|
44
42
|
invalid_state_error: "Invalid vApp State %{message}"
|
43
|
+
invalid_request_error: "Invalid request %{message}"
|
44
|
+
unattended_code_error: "Unattended code received %{message}"
|
45
|
+
endpoint_unavailable: "Can't connect to the specified endpoint %{endpoint}, please verify connectivity."
|
45
46
|
subnet_errors:
|
46
47
|
invalid_subnet: "The specified subnet is invalid: %{message}"
|
47
48
|
subnet_too_small: "The specified subnet is too small: %{message}, must contain at least 2 usable IPs (/30 or 255.255.255.252)"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Rapposelli
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|