vagrant-vcloud 0.1.0 → 0.1.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/.gitignore +4 -1
- data/README.md +30 -6
- data/lib/vagrant-vcloud/action/build_vapp.rb +28 -28
- data/lib/vagrant-vcloud/action/connect_vcloud.rb +0 -1
- data/lib/vagrant-vcloud/action/destroy.rb +1 -9
- data/lib/vagrant-vcloud/action/forward_ports.rb +2 -38
- data/lib/vagrant-vcloud/action/handle_nat_port_collisions.rb +0 -8
- data/lib/vagrant-vcloud/action/inventory_check.rb +11 -12
- data/lib/vagrant-vcloud/action/power_off.rb +22 -4
- data/lib/vagrant-vcloud/action/power_on.rb +3 -1
- data/lib/vagrant-vcloud/action/read_ssh_info.rb +4 -6
- data/lib/vagrant-vcloud/action/sync_folders.rb +41 -10
- data/lib/vagrant-vcloud/config.rb +15 -7
- data/lib/vagrant-vcloud/driver/base.rb +35 -54
- data/lib/vagrant-vcloud/driver/meta.rb +28 -17
- data/lib/vagrant-vcloud/driver/version_5_1.rb +54 -54
- data/lib/vagrant-vcloud/errors.rb +7 -0
- data/lib/vagrant-vcloud/version.rb +1 -1
- data/locales/en.yml +20 -0
- data/vagrant-vcloud.gemspec +0 -3
- metadata +3 -44
@@ -275,73 +275,54 @@ module VagrantPlugins
|
|
275
275
|
end
|
276
276
|
|
277
277
|
private
|
278
|
+
|
278
279
|
##
|
279
|
-
# Sends a synchronous request to the vCloud API and returns the response as parsed XML + headers.
|
280
|
+
# Sends a synchronous request to the vCloud API and returns the response as parsed XML + headers using HTTPClient.
|
280
281
|
def send_request(params, payload=nil, content_type=nil)
|
281
|
-
headers = {:accept => "application/*+xml;version=#{@api_version}"}
|
282
|
-
if @auth_key
|
283
|
-
headers.merge!({:x_vcloud_authorization => @auth_key})
|
284
|
-
end
|
285
282
|
|
286
|
-
|
287
|
-
|
288
|
-
end
|
283
|
+
# Create a new HTTP client
|
284
|
+
clnt = HTTPClient.new
|
289
285
|
|
290
|
-
#
|
286
|
+
# Disable SSL cert verification
|
287
|
+
clnt.ssl_config.verify_mode=(OpenSSL::SSL::VERIFY_NONE)
|
288
|
+
|
289
|
+
# Suppress SSL depth message
|
290
|
+
clnt.ssl_config.verify_callback=proc{ |ok, ctx|; true };
|
291
|
+
|
292
|
+
extheader = {}
|
291
293
|
|
292
|
-
|
293
|
-
:user => "#{@username}@#{@org_name}",
|
294
|
-
:password => @password,
|
295
|
-
:headers => headers,
|
296
|
-
:url => "#{@api_url}#{params['command']}",
|
297
|
-
:payload => payload)
|
294
|
+
extheader["accept"] = "application/*+xml;version=#{@api_version}"
|
298
295
|
|
296
|
+
if !content_type.nil?
|
297
|
+
extheader['Content-Type'] = content_type
|
298
|
+
end
|
299
|
+
|
300
|
+
if @auth_key
|
301
|
+
extheader['x-vcloud-authorization'] = @auth_key
|
302
|
+
else
|
303
|
+
clnt.set_auth(nil, "#{@username}@#{@org_name}", @password)
|
304
|
+
end
|
305
|
+
|
306
|
+
url = "#{@api_url}#{params['command']}"
|
299
307
|
|
300
308
|
begin
|
301
|
-
response = request
|
302
|
-
if !
|
303
|
-
|
309
|
+
response = clnt.request(params['method'], url, nil, payload, extheader)
|
310
|
+
if !response.ok?
|
311
|
+
raise "Warning: unattended code #{response.status} #{response.reason}"
|
304
312
|
end
|
305
313
|
|
306
|
-
|
307
|
-
|
308
|
-
rescue
|
309
|
-
raise
|
310
|
-
rescue
|
311
|
-
raise
|
312
|
-
rescue RestClient::BadRequest => e
|
313
|
-
body = Nokogiri.parse(e.http_body)
|
314
|
-
message = body.css("Error").first["message"]
|
315
|
-
|
316
|
-
case message
|
317
|
-
when /The request has invalid accept header/
|
318
|
-
raise WrongAPIVersion, "Invalid accept header. Please verify that the server supports v.#{@api_version} or specify a different API Version."
|
319
|
-
when /validation error on field 'id': String value has invalid format or length/
|
320
|
-
raise WrongItemIDError, "Invalid ID specified. Please verify that the item exists and correctly typed."
|
321
|
-
when /The requested operation could not be executed on vApp "(.*)". Stop the vApp and try again/
|
322
|
-
raise Errors::InvalidStateError, :message => "Invalid request because vApp is running. Stop vApp '#{$1}' and try again."
|
323
|
-
when /The requested operation could not be executed since vApp "(.*)" is not running/
|
324
|
-
raise Errors::InvalidStateError, :message => "Invalid request because vApp is stopped. Start vApp '#{$1}' and try again."
|
325
|
-
when /The administrator password cannot be empty when it is enabled and automatic password generation is not selected/
|
326
|
-
raise Errors::InvalidConfigError
|
327
|
-
when /The reference "(.*)" cannot be parsed correctly/ # FIXME: doesn't work
|
328
|
-
raise Errors::InvalidNetSpecification
|
329
|
-
else
|
330
|
-
raise UnhandledError, "BadRequest - unhandled error: #{message}.\nPlease report this issue."
|
331
|
-
end
|
332
|
-
rescue RestClient::Forbidden => e
|
333
|
-
body = Nokogiri.parse(e.http_body)
|
334
|
-
message = body.css("Error").first["message"]
|
335
|
-
raise Errors::UnauthorizedAccess
|
336
|
-
rescue RestClient::InternalServerError => e
|
337
|
-
body = Nokogiri.parse(e.http_body)
|
338
|
-
message = body.css("Error").first["message"]
|
339
|
-
raise InternalServerError, "Internal Server Error: #{message}."
|
340
|
-
rescue RestClient::Found => e
|
341
|
-
raise Errors::HostRedirect
|
314
|
+
[Nokogiri.parse(response.body), response.headers]
|
315
|
+
|
316
|
+
rescue SocketError
|
317
|
+
raise "Impossible to connect, verify endpoint"
|
318
|
+
rescue Errno::EADDRNOTAVAIL
|
319
|
+
raise "Impossible to connect, verify endpoint"
|
342
320
|
end
|
321
|
+
|
322
|
+
|
343
323
|
end
|
344
324
|
|
325
|
+
|
345
326
|
##
|
346
327
|
# Upload a large file in configurable chunks, output an optional progressbar
|
347
328
|
def upload_file(uploadURL, uploadFile, vAppTemplate, config={})
|
@@ -17,8 +17,8 @@
|
|
17
17
|
|
18
18
|
require "forwardable"
|
19
19
|
require "log4r"
|
20
|
-
require "rest-client"
|
21
20
|
require "nokogiri"
|
21
|
+
require "httpclient"
|
22
22
|
|
23
23
|
|
24
24
|
require File.expand_path("../base", __FILE__)
|
@@ -51,7 +51,8 @@ module VagrantPlugins
|
|
51
51
|
# Instantiate the proper version driver for vCloud
|
52
52
|
@logger.debug("Finding driver for vCloud version: #{@version}")
|
53
53
|
driver_map = {
|
54
|
-
"5.1" => Version_5_1
|
54
|
+
"5.1" => Version_5_1,
|
55
|
+
"5.5" => Version_5_1 # Binding vCloud 5.5 API on our current 5.1 implementation
|
55
56
|
}
|
56
57
|
|
57
58
|
if @version.start_with?("0.9") || @version.start_with?("1.0") || @version.start_with?("1.5")
|
@@ -121,30 +122,40 @@ module VagrantPlugins
|
|
121
122
|
|
122
123
|
def get_api_version(host_url)
|
123
124
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
125
|
+
# Create a new HTTP client
|
126
|
+
clnt = HTTPClient.new
|
127
|
+
|
128
|
+
# Disable SSL cert verification
|
129
|
+
clnt.ssl_config.verify_mode=(OpenSSL::SSL::VERIFY_NONE)
|
130
|
+
|
131
|
+
# Suppress SSL depth message
|
132
|
+
clnt.ssl_config.verify_callback=proc{ |ok, ctx|; true };
|
128
133
|
|
134
|
+
url = "#{host_url}/api/versions"
|
135
|
+
|
129
136
|
begin
|
130
|
-
response = request
|
131
|
-
if !
|
132
|
-
|
137
|
+
response = clnt.request("GET", url, nil, nil, nil)
|
138
|
+
if !response.ok?
|
139
|
+
raise "Warning: unattended code #{response.status} #{response.reason}"
|
133
140
|
end
|
134
141
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
+
versionInfo = Nokogiri.parse(response.body)
|
143
|
+
# FIXME: Find a smarter way to check for vCloud API version
|
144
|
+
# Changed from .first to .last because that's the way it's defined
|
145
|
+
# in the request answer.
|
146
|
+
apiVersion = versionInfo.css("VersionInfo Version")
|
147
|
+
|
148
|
+
apiVersion.last.text
|
142
149
|
|
143
|
-
|
150
|
+
|
151
|
+
rescue SocketError
|
152
|
+
raise Errors::HostNotFound, :message => host_url
|
153
|
+
rescue Errno::EADDRNOTAVAIL
|
144
154
|
raise Errors::HostNotFound, :message => host_url
|
145
155
|
end
|
146
156
|
|
147
157
|
end
|
158
|
+
|
148
159
|
end
|
149
160
|
end
|
150
161
|
end
|
@@ -15,9 +15,6 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require "rest-client"
|
19
|
-
require "nokogiri"
|
20
|
-
require "httpclient"
|
21
18
|
require "ruby-progressbar"
|
22
19
|
require "set"
|
23
20
|
require "netaddr"
|
@@ -54,11 +51,11 @@ module VagrantPlugins
|
|
54
51
|
|
55
52
|
response, headers = send_request(params)
|
56
53
|
|
57
|
-
if !headers.has_key?(
|
54
|
+
if !headers.has_key?("x-vcloud-authorization")
|
58
55
|
raise "Unable to authenticate: missing x_vcloud_authorization header"
|
59
56
|
end
|
60
57
|
|
61
|
-
@auth_key = headers[
|
58
|
+
@auth_key = headers["x-vcloud-authorization"]
|
62
59
|
end
|
63
60
|
|
64
61
|
##
|
@@ -391,7 +388,7 @@ module VagrantPlugins
|
|
391
388
|
}
|
392
389
|
|
393
390
|
response, headers = send_request(params)
|
394
|
-
task_id = headers[
|
391
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
395
392
|
task_id
|
396
393
|
end
|
397
394
|
|
@@ -412,7 +409,7 @@ module VagrantPlugins
|
|
412
409
|
|
413
410
|
response, headers = send_request(params, builder.to_xml,
|
414
411
|
"application/vnd.vmware.vcloud.undeployVAppParams+xml")
|
415
|
-
task_id = headers[
|
412
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
416
413
|
task_id
|
417
414
|
end
|
418
415
|
|
@@ -425,7 +422,7 @@ module VagrantPlugins
|
|
425
422
|
}
|
426
423
|
|
427
424
|
response, headers = send_request(params)
|
428
|
-
task_id = headers[
|
425
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
429
426
|
task_id
|
430
427
|
end
|
431
428
|
|
@@ -441,7 +438,7 @@ module VagrantPlugins
|
|
441
438
|
}
|
442
439
|
|
443
440
|
response, headers = send_request(params)
|
444
|
-
task_id = headers[
|
441
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
445
442
|
task_id
|
446
443
|
end
|
447
444
|
|
@@ -456,7 +453,7 @@ module VagrantPlugins
|
|
456
453
|
}
|
457
454
|
|
458
455
|
response, headers = send_request(params)
|
459
|
-
task_id = headers[
|
456
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
460
457
|
task_id
|
461
458
|
end
|
462
459
|
|
@@ -469,7 +466,7 @@ module VagrantPlugins
|
|
469
466
|
}
|
470
467
|
|
471
468
|
response, headers = send_request(params)
|
472
|
-
task_id = headers[
|
469
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
473
470
|
task_id
|
474
471
|
end
|
475
472
|
|
@@ -484,7 +481,7 @@ module VagrantPlugins
|
|
484
481
|
}
|
485
482
|
|
486
483
|
response, headers = send_request(params)
|
487
|
-
task_id = headers[
|
484
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
488
485
|
task_id
|
489
486
|
end
|
490
487
|
|
@@ -507,7 +504,7 @@ module VagrantPlugins
|
|
507
504
|
|
508
505
|
response, headers = send_request(params, builder.to_xml,
|
509
506
|
"application/vnd.vmware.vcloud.undeployVAppParams+xml")
|
510
|
-
task_id = headers[
|
507
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
511
508
|
task_id
|
512
509
|
end
|
513
510
|
|
@@ -528,7 +525,7 @@ module VagrantPlugins
|
|
528
525
|
|
529
526
|
response, headers = send_request(params, builder.to_xml,
|
530
527
|
"application/vnd.vmware.vcloud.undeployVAppParams+xml")
|
531
|
-
task_id = headers[
|
528
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
532
529
|
task_id
|
533
530
|
end
|
534
531
|
|
@@ -544,7 +541,7 @@ module VagrantPlugins
|
|
544
541
|
}
|
545
542
|
|
546
543
|
response, headers = send_request(params)
|
547
|
-
task_id = headers[
|
544
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
548
545
|
task_id
|
549
546
|
end
|
550
547
|
|
@@ -559,7 +556,7 @@ module VagrantPlugins
|
|
559
556
|
}
|
560
557
|
|
561
558
|
response, headers = send_request(params)
|
562
|
-
task_id = headers[
|
559
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
563
560
|
task_id
|
564
561
|
end
|
565
562
|
|
@@ -572,7 +569,7 @@ module VagrantPlugins
|
|
572
569
|
}
|
573
570
|
|
574
571
|
response, headers = send_request(params)
|
575
|
-
task_id = headers[
|
572
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
576
573
|
task_id
|
577
574
|
end
|
578
575
|
|
@@ -589,7 +586,7 @@ module VagrantPlugins
|
|
589
586
|
}
|
590
587
|
|
591
588
|
response, headers = send_request(params)
|
592
|
-
task_id = headers[
|
589
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
593
590
|
task_id
|
594
591
|
end
|
595
592
|
|
@@ -653,7 +650,7 @@ module VagrantPlugins
|
|
653
650
|
|
654
651
|
response, headers = send_request(params, builder.to_xml, "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
655
652
|
|
656
|
-
vapp_id = headers[
|
653
|
+
vapp_id = headers["Location"].gsub("#{@api_url}/vApp/vapp-", "")
|
657
654
|
|
658
655
|
task = response.css("VApp Task[operationName='vdcInstantiateVapp']").first
|
659
656
|
task_id = task["href"].gsub("#{@api_url}/task/", "")
|
@@ -748,7 +745,7 @@ module VagrantPlugins
|
|
748
745
|
|
749
746
|
response, headers = send_request(params, builder.to_xml, "application/vnd.vmware.vcloud.composeVAppParams+xml")
|
750
747
|
|
751
|
-
vapp_id = headers[
|
748
|
+
vapp_id = headers["Location"].gsub("#{@api_url}/vApp/vapp-", "")
|
752
749
|
|
753
750
|
task = response.css("VApp Task[operationName='vdcComposeVapp']").first
|
754
751
|
task_id = task["href"].gsub("#{@api_url}/task/", "")
|
@@ -808,7 +805,7 @@ module VagrantPlugins
|
|
808
805
|
|
809
806
|
response, headers = send_request(params, builder.to_xml, "application/vnd.vmware.vcloud.recomposeVAppParams+xml")
|
810
807
|
|
811
|
-
vapp_id = headers[
|
808
|
+
vapp_id = headers["Location"].gsub("#{@api_url}/vApp/vapp-", "")
|
812
809
|
|
813
810
|
task = response.css("Task [operationName='vdcRecomposeVapp']").first
|
814
811
|
task_id = task["href"].gsub("#{@api_url}/task/", "")
|
@@ -903,7 +900,7 @@ module VagrantPlugins
|
|
903
900
|
|
904
901
|
response, headers = send_request(params, builder.to_xml, "application/vnd.vmware.vcloud.networkConfigSection+xml")
|
905
902
|
|
906
|
-
task_id = headers[
|
903
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
907
904
|
task_id
|
908
905
|
end
|
909
906
|
|
@@ -933,8 +930,7 @@ module VagrantPlugins
|
|
933
930
|
xml.Policy(config[:nat_policy_type] || "allowTraffic")
|
934
931
|
|
935
932
|
preExisting = get_vapp_port_forwarding_rules(vappid)
|
936
|
-
|
937
|
-
|
933
|
+
|
938
934
|
config[:nat_rules].concat(preExisting)
|
939
935
|
|
940
936
|
config[:nat_rules].each do |nat_rule|
|
@@ -962,7 +958,7 @@ module VagrantPlugins
|
|
962
958
|
|
963
959
|
response, headers = send_request(params, builder.to_xml, "application/vnd.vmware.vcloud.networkConfigSection+xml")
|
964
960
|
|
965
|
-
task_id = headers[
|
961
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
966
962
|
task_id
|
967
963
|
end
|
968
964
|
|
@@ -1082,23 +1078,27 @@ module VagrantPlugins
|
|
1082
1078
|
}
|
1083
1079
|
|
1084
1080
|
response, headers = send_request(params)
|
1085
|
-
|
1086
1081
|
response.css("EdgeGateway Configuration GatewayInterfaces GatewayInterface").each do |gw|
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1082
|
+
|
1083
|
+
# Only check uplinks, avoid another check
|
1084
|
+
if gw.css("InterfaceType").text == "uplink"
|
1085
|
+
|
1086
|
+
# Loop on all sub-allocation pools
|
1087
|
+
gw.css("SubnetParticipation IpRanges IpRange").each do |currentRange|
|
1088
|
+
|
1089
|
+
lowip = currentRange.css("StartAddress").first.text
|
1090
|
+
highip = currentRange.css("EndAddress").first.text
|
1091
|
+
|
1092
|
+
rangeIpLow = NetAddr.ip_to_i(lowip)
|
1093
|
+
rangeIpHigh = NetAddr.ip_to_i(highip)
|
1094
|
+
testIp = NetAddr.ip_to_i(edge_gateway_ip)
|
1095
|
+
|
1096
|
+
if (rangeIpLow..rangeIpHigh) === testIp
|
1097
|
+
return gw.css("Network").first[:href]
|
1098
|
+
end
|
1099
|
+
end
|
1090
1100
|
end
|
1091
1101
|
|
1092
|
-
lowip = gw.css("SubnetParticipation IpRanges IpRange StartAddress").first.text
|
1093
|
-
highip = gw.css("SubnetParticipation IpRanges IpRange EndAddress").first.text
|
1094
|
-
|
1095
|
-
rangeIpLow = NetAddr.ip_to_i(lowip)
|
1096
|
-
rangeIpHigh = NetAddr.ip_to_i(highip)
|
1097
|
-
testIp = NetAddr.ip_to_i(edge_gateway_ip)
|
1098
|
-
|
1099
|
-
if (rangeIpLow..rangeIpHigh) === testIp
|
1100
|
-
return gw.css("Network").first[:href]
|
1101
|
-
end
|
1102
1102
|
end
|
1103
1103
|
|
1104
1104
|
end
|
@@ -1139,6 +1139,7 @@ module VagrantPlugins
|
|
1139
1139
|
|
1140
1140
|
interface = Nokogiri::XML::Node.new 'Interface', response
|
1141
1141
|
interface["href"] = edge_network_id
|
1142
|
+
|
1142
1143
|
gatewayNatRule.add_child interface
|
1143
1144
|
|
1144
1145
|
originalIp = Nokogiri::XML::Node.new 'OriginalIp', response
|
@@ -1161,9 +1162,12 @@ module VagrantPlugins
|
|
1161
1162
|
protocol.content = "any"
|
1162
1163
|
gatewayNatRule.add_child protocol
|
1163
1164
|
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1165
|
+
# FIXME: frapposelli/tsugliani we should be able to remove this
|
1166
|
+
# FIXME: test this against a vCloud Director 5.1.x installation
|
1167
|
+
#icmpSubType = Nokogiri::XML::Node.new 'IcmpSubType', response
|
1168
|
+
#icmpSubType.content = "any"
|
1169
|
+
#gatewayNatRule.add_child icmpSubType
|
1170
|
+
|
1167
1171
|
|
1168
1172
|
natRule2 = Nokogiri::XML::Node.new 'NatRule', response
|
1169
1173
|
|
@@ -1180,6 +1184,7 @@ module VagrantPlugins
|
|
1180
1184
|
|
1181
1185
|
interface = Nokogiri::XML::Node.new 'Interface', response
|
1182
1186
|
interface["href"] = edge_network_id
|
1187
|
+
|
1183
1188
|
gatewayNatRule.add_child interface
|
1184
1189
|
|
1185
1190
|
originalIp = Nokogiri::XML::Node.new 'OriginalIp', response
|
@@ -1249,7 +1254,6 @@ module VagrantPlugins
|
|
1249
1254
|
nat_rules << natRule2
|
1250
1255
|
|
1251
1256
|
fw_rules = set_edge_rules.at_css("FirewallService")
|
1252
|
-
|
1253
1257
|
fw_rules << firewallRule1
|
1254
1258
|
|
1255
1259
|
xml1 = set_edge_rules.at_css "EdgeGatewayServiceConfiguration"
|
@@ -1261,11 +1265,9 @@ module VagrantPlugins
|
|
1261
1265
|
'command' => "/admin/edgeGateway/#{edge_gateway_id}/action/configureServices"
|
1262
1266
|
}
|
1263
1267
|
|
1264
|
-
@logger.debug("OUR XML: #{set_edge_rules.to_xml(:indent => 2)}")
|
1265
|
-
|
1266
1268
|
response, headers = send_request(params, set_edge_rules.to_xml(:indent => 2), "application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml")
|
1267
1269
|
|
1268
|
-
task_id = headers[
|
1270
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
1269
1271
|
task_id
|
1270
1272
|
|
1271
1273
|
end
|
@@ -1311,11 +1313,9 @@ module VagrantPlugins
|
|
1311
1313
|
'command' => "/admin/edgeGateway/#{edge_gateway_id}/action/configureServices"
|
1312
1314
|
}
|
1313
1315
|
|
1314
|
-
@logger.debug("OUR XML: #{remove_edge_rules.to_xml}")
|
1315
|
-
|
1316
1316
|
response, headers = send_request(params, remove_edge_rules.to_xml, "application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml")
|
1317
1317
|
|
1318
|
-
task_id = headers[
|
1318
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
1319
1319
|
task_id
|
1320
1320
|
end
|
1321
1321
|
|
@@ -1398,7 +1398,7 @@ module VagrantPlugins
|
|
1398
1398
|
)
|
1399
1399
|
|
1400
1400
|
# Get vAppTemplate Link from location
|
1401
|
-
vAppTemplate = headers[
|
1401
|
+
vAppTemplate = headers["Location"].gsub("#{@api_url}/vAppTemplate/vappTemplate-", "")
|
1402
1402
|
@logger.debug("Getting vAppTemplate ID: #{vAppTemplate}")
|
1403
1403
|
descriptorUpload = response.css("Files Link [rel='upload:default']").first[:href].gsub("#{@host_url}/transfer/", "")
|
1404
1404
|
transferGUID = descriptorUpload.gsub("/descriptor.ovf", "")
|
@@ -1524,7 +1524,7 @@ module VagrantPlugins
|
|
1524
1524
|
task = get_task(taskid)
|
1525
1525
|
@logger.debug("Evaluating taskid: #{taskid}, current status #{task[:status]}")
|
1526
1526
|
break if task[:status] != 'running'
|
1527
|
-
sleep
|
1527
|
+
sleep 5
|
1528
1528
|
end
|
1529
1529
|
|
1530
1530
|
if task[:status] == 'error'
|
@@ -1562,7 +1562,7 @@ module VagrantPlugins
|
|
1562
1562
|
|
1563
1563
|
response, headers = send_request(params, builder.to_xml, "application/vnd.vmware.vcloud.networkConfigSection+xml")
|
1564
1564
|
|
1565
|
-
task_id = headers[
|
1565
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
1566
1566
|
task_id
|
1567
1567
|
end
|
1568
1568
|
|
@@ -1591,7 +1591,7 @@ module VagrantPlugins
|
|
1591
1591
|
|
1592
1592
|
response, headers = send_request(params, builder.to_xml, "application/vnd.vmware.vcloud.networkConnectionSection+xml")
|
1593
1593
|
|
1594
|
-
task_id = headers[
|
1594
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
1595
1595
|
task_id
|
1596
1596
|
end
|
1597
1597
|
|
@@ -1617,7 +1617,7 @@ module VagrantPlugins
|
|
1617
1617
|
}
|
1618
1618
|
|
1619
1619
|
response, headers = send_request(params, builder.to_xml, "application/vnd.vmware.vcloud.guestCustomizationSection+xml")
|
1620
|
-
task_id = headers[
|
1620
|
+
task_id = headers["Location"].gsub("#{@api_url}/task/", "")
|
1621
1621
|
task_id
|
1622
1622
|
end
|
1623
1623
|
|
@@ -6,6 +6,13 @@ module VagrantPlugins
|
|
6
6
|
class VCloudError < Vagrant::Errors::VagrantError
|
7
7
|
error_namespace("vagrant_vcloud.errors")
|
8
8
|
end
|
9
|
+
class RsyncError < VCloudError
|
10
|
+
error_key(:rsync_error)
|
11
|
+
end
|
12
|
+
|
13
|
+
class MkdirError < VCloudError
|
14
|
+
error_key(:mkdir_error)
|
15
|
+
end
|
9
16
|
class VCloudOldVersion < VCloudError
|
10
17
|
error_key(:vcloud_old_version)
|
11
18
|
end
|
data/locales/en.yml
CHANGED
@@ -4,9 +4,15 @@ en:
|
|
4
4
|
will_not_destroy: "VM will not be destroyed"
|
5
5
|
vm_already_running: "VM is already running"
|
6
6
|
vm_halted_cannot_suspend: "VM is not running or already suspended, cannot suspend it."
|
7
|
+
rsync_not_found_warning: |-
|
8
|
+
Warning! Folder sync disabled because the rsync binary is missing.
|
9
|
+
Make sure rsync is installed and the binary can be found in the PATH.
|
10
|
+
rsync_folder: |-
|
11
|
+
Rsyncing folder: %{hostpath} => %{guestpath}
|
7
12
|
config:
|
8
13
|
api_version: "Configuration must specify a vCloud API version (default=5.1)"
|
9
14
|
catalog_name: "Configuration must specify a vCloud Director Catalog (for the VM templates images)"
|
15
|
+
ip_dns: "DNS configuration must be specified as an Array type"
|
10
16
|
compute_resource: "Configuration must specify a compute resource name"
|
11
17
|
hostname: "Configuration must specify a vCloud Director hostname"
|
12
18
|
name: "Configuration must specify a VM name"
|
@@ -37,6 +43,20 @@ en:
|
|
37
43
|
subnet_errors:
|
38
44
|
invalid_subnet: "The specified subnet is invalid: %{message}"
|
39
45
|
subnet_too_small: "The specified subnet is too small: %{message}, must contain at least 2 usable IPs (/30 or 255.255.255.252)"
|
46
|
+
rsync_error: |-
|
47
|
+
There was an error when attempting to rsync a share folder.
|
48
|
+
Please inspect the error message below for more info.
|
49
|
+
|
50
|
+
Host path: %{hostpath}
|
51
|
+
Guest path: %{guestpath}
|
52
|
+
Error: %{stderr}
|
53
|
+
mkdir_error: |-
|
54
|
+
There was an error when attempting to create a shared host folder.
|
55
|
+
Please inspect the error message below for more info.
|
56
|
+
|
57
|
+
Host path: %{hostpath}
|
58
|
+
Error: %{err}
|
59
|
+
|
40
60
|
states:
|
41
61
|
not_created: |-
|
42
62
|
The environment has not yet been created. Run `vagrant up` to
|
data/vagrant-vcloud.gemspec
CHANGED
@@ -13,11 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = 'Enables Vagrant to manage machines with VMware vCloud Director®.'
|
14
14
|
|
15
15
|
s.add_runtime_dependency 'i18n', '~> 0.6.4'
|
16
|
-
s.add_runtime_dependency 'ruby-unison', '~> 0.0.3'
|
17
16
|
s.add_runtime_dependency 'log4r', '~> 1.1.10'
|
18
|
-
s.add_runtime_dependency 'awesome_print', '~> 1.1.0'
|
19
17
|
s.add_runtime_dependency 'nokogiri', '~> 1.6.0'
|
20
|
-
s.add_runtime_dependency 'rest-client', '~> 1.6.7'
|
21
18
|
s.add_runtime_dependency 'httpclient', '~> 2.3.4.1'
|
22
19
|
s.add_runtime_dependency 'ruby-progressbar', '~> 1.1.1'
|
23
20
|
s.add_runtime_dependency 'netaddr', '~> 1.5.0'
|