vagrant-vcloud 0.4.7 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/lib/vagrant-vcloud/action/power_on.rb +12 -0
- data/lib/vagrant-vcloud/config.rb +3 -0
- data/lib/vagrant-vcloud/driver/meta.rb +1 -20
- data/lib/vagrant-vcloud/driver/version_5_1.rb +37 -0
- data/lib/vagrant-vcloud/errors.rb +3 -0
- data/lib/vagrant-vcloud/version.rb +1 -1
- data/locales/en.yml +1 -0
- 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: c8427f350e6d164ba8d274b7423f2e24c5d5a6ee
|
4
|
+
data.tar.gz: 91b7763f8209990f9626e98b52a0696d04b37fc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36107695a03114903e000f3bfdcb6062b4ba3d3d50287aff3dca5ee993fe8da6b5f1b30754d5060bacaa29498f19897f0a3e80e4bf0b6bd06aa47bbf58ed041c
|
7
|
+
data.tar.gz: e0c47dcb939dd7b9a22d9d9d2b971b0573881fed34fdba6114ad5462e58b5eadf2d9485caa841abf3a6ca8ad6521a4522826223d006155696749d23f0b1a064c
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[Vagrant](http://www.vagrantup.com) provider for VMware vCloud Director® [![Gem Version](https://badge.fury.io/rb/vagrant-vcloud.svg)](http://badge.fury.io/rb/vagrant-vcloud) [![Code Climate](https://codeclimate.com/github/frapposelli/vagrant-vcloud/badges/gpa.svg)](https://codeclimate.com/github/frapposelli/vagrant-vcloud) [![Dependency Status](https://gemnasium.com/frapposelli/vagrant-vcloud.svg)](https://gemnasium.com/frapposelli/vagrant-vcloud)
|
1
|
+
[Vagrant](http://www.vagrantup.com) provider for VMware vCloud Director® [![Gem Version](https://badge.fury.io/rb/vagrant-vcloud.svg)](http://badge.fury.io/rb/vagrant-vcloud) [![Code Climate](https://codeclimate.com/github/frapposelli/vagrant-vcloud/badges/gpa.svg)](https://codeclimate.com/github/frapposelli/vagrant-vcloud) [![Dependency Status](https://gemnasium.com/frapposelli/vagrant-vcloud.svg)](https://gemnasium.com/frapposelli/vagrant-vcloud)
|
2
2
|
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
|
3
3
|
|
4
4
|
Please note that this software is still Alpha/Beta quality and is not recommended for production usage.
|
@@ -52,6 +52,9 @@ vapp = {
|
|
52
52
|
ip_subnet: '10.10.10.10/255.255.255.0'
|
53
53
|
}
|
54
54
|
]
|
55
|
+
},
|
56
|
+
ovf_properties: {
|
57
|
+
'test-variable' => 'true'
|
55
58
|
}
|
56
59
|
}
|
57
60
|
|
@@ -132,6 +135,9 @@ Vagrant.configure('2') do |config|
|
|
132
135
|
pro.nested_hypervisor = node[:nested_hypervisor]
|
133
136
|
pro.enable_guest_customization = node[:enable_guest_customization]
|
134
137
|
pro.guest_customization_script = node[:guest_customization_script]
|
138
|
+
if vapp[:ovf_properties]
|
139
|
+
pro.ovf_properties = vapp[:ovf_properties]
|
140
|
+
end
|
135
141
|
end
|
136
142
|
node_config.vm.network :public_network
|
137
143
|
else
|
@@ -50,6 +50,18 @@ module VagrantPlugins
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
# set ovf properties
|
54
|
+
if !cfg.ovf_properties.nil?
|
55
|
+
env[:ui].info('Setting VM OVF Properties...')
|
56
|
+
set_ovf_properties = cnx.set_ovf_properties(env[:machine].id, cfg.ovf_properties)
|
57
|
+
if set_ovf_properties
|
58
|
+
wait = cnx.wait_task_completion(set_ovf_properties)
|
59
|
+
unless wait[:errormsg].nil?
|
60
|
+
fail Errors::SetOvfPropertyError, :message => wait[:errormsg]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
53
65
|
if cfg.power_on.nil? || cfg.power_on == true
|
54
66
|
env[:ui].info('Powering on VM...')
|
55
67
|
poweron_vm = cnx.poweron_vm(env[:machine].id)
|
@@ -262,6 +262,9 @@ module VagrantPlugins
|
|
262
262
|
# guest customization admin require password reset (Bool = false)
|
263
263
|
attr_accessor :guest_customization_admin_password_reset
|
264
264
|
|
265
|
+
# ovf properties object (Hash)
|
266
|
+
attr_accessor :ovf_properties
|
267
|
+
|
265
268
|
def validate(machine)
|
266
269
|
errors = _detected_errors
|
267
270
|
|
@@ -46,13 +46,6 @@ module VagrantPlugins
|
|
46
46
|
|
47
47
|
# Instantiate the proper version driver for vCloud
|
48
48
|
@logger.debug("Finding driver for vCloud version: #{@version}")
|
49
|
-
driver_map = {
|
50
|
-
'5.1' => Version_5_1,
|
51
|
-
'5.5' => Version_5_1, # Binding vCloud 5.5 API on our current 5.1 implementation
|
52
|
-
'5.6' => Version_5_1, # Binding vCHS API on our current 5.1 implementation
|
53
|
-
'5.7' => Version_5_1, # Binding vCHS API on our current 5.1 implementation
|
54
|
-
'9.0' => Version_5_1 # Binding vCHS API on our current 5.1 implementation
|
55
|
-
}
|
56
49
|
|
57
50
|
if @version.start_with?('0.9') ||
|
58
51
|
@version.start_with?('1.0') ||
|
@@ -61,19 +54,7 @@ module VagrantPlugins
|
|
61
54
|
raise Errors::VCloudOldVersion, :version => @version
|
62
55
|
end
|
63
56
|
|
64
|
-
driver_klass =
|
65
|
-
driver_map.each do |key, klass|
|
66
|
-
if @version.start_with?(key)
|
67
|
-
driver_klass = klass
|
68
|
-
break
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
if !driver_klass
|
73
|
-
supported_versions = driver_map.keys.sort.join(', ')
|
74
|
-
raise Errors::VCloudInvalidVersion,
|
75
|
-
:supported_versions => supported_versions
|
76
|
-
end
|
57
|
+
driver_klass = Version_5_1 # Binding any vCloud API on our current 5.1 implementation
|
77
58
|
|
78
59
|
@logger.info("Using vCloud driver: #{driver_klass}")
|
79
60
|
@driver = driver_klass.new(@hostname, @username, @password, @org_name)
|
@@ -2278,6 +2278,43 @@ module VagrantPlugins
|
|
2278
2278
|
|
2279
2279
|
end
|
2280
2280
|
|
2281
|
+
##
|
2282
|
+
# Set OVF data
|
2283
|
+
def set_ovf_properties(vm_id, properties)
|
2284
|
+
params = {
|
2285
|
+
'method' => :get,
|
2286
|
+
'command' => "/vApp/vm-#{vm_id}/productSections"
|
2287
|
+
}
|
2288
|
+
response, _headers = send_request(params)
|
2289
|
+
|
2290
|
+
changed = false
|
2291
|
+
response.css('ovf|Property').each do |prop|
|
2292
|
+
next if prop['ovf:userConfigurable'] == 'false'
|
2293
|
+
key = prop['ovf:key']
|
2294
|
+
next if !properties[ key ]
|
2295
|
+
if properties[ key ] != prop['ovf:value']
|
2296
|
+
changed = true
|
2297
|
+
prop['ovf:value'] = properties[ key ]
|
2298
|
+
end
|
2299
|
+
end
|
2300
|
+
|
2301
|
+
if changed
|
2302
|
+
params = {
|
2303
|
+
'method' => :put,
|
2304
|
+
'command' => "/vApp/vm-#{vm_id}/productSections"
|
2305
|
+
}
|
2306
|
+
_response, headers = send_request(
|
2307
|
+
params,
|
2308
|
+
response.to_xml,
|
2309
|
+
'application/vnd.vmware.vcloud.productSections+xml'
|
2310
|
+
)
|
2311
|
+
|
2312
|
+
task_id = URI(headers['Location']).path.gsub('/api/task/', '')
|
2313
|
+
return task_id
|
2314
|
+
end
|
2315
|
+
return nil
|
2316
|
+
end
|
2317
|
+
|
2281
2318
|
##
|
2282
2319
|
# Fetch details about a given VM
|
2283
2320
|
def get_vm(vm_id)
|
data/locales/en.yml
CHANGED
@@ -62,6 +62,7 @@ en:
|
|
62
62
|
|
63
63
|
Host path: %{hostpath}
|
64
64
|
Error: %{err}
|
65
|
+
ovf_property_error: "Error setting OVF Properties: %{message}"
|
65
66
|
gc:
|
66
67
|
admin_password: "Guest customization must be enabled to generate/specify password"
|
67
68
|
admin_password_gs: "Admin assword must be auto generated or secified"
|
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
|
+
version: 0.5.0
|
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:
|
12
|
+
date: 2018-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-progressbar
|