clc-chef-metal-vsphere 0.3.28 → 0.3.29
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68d9eedf92290d646eed6336f14df0c8741ed80e
|
4
|
+
data.tar.gz: 82ab5a9f32eeeb89dd84b1084f83b054f4ae1c78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bba831e0b9f53578e8f2b4348af243ae611412cb4485871c1e97bbc349054faf357bd149bd819745662f1c9f18383b8d4efdeb596324b11e9f0233d1b03f838
|
7
|
+
data.tar.gz: aee793315ea55f4db94b7d465ecd199ae079d60da45230cc53a41ce04cf9f27ae9fd0274c648f92da763b0b763f2808227a408687414ab59861ef0dd111e2bc6
|
@@ -169,7 +169,7 @@ module ChefMetalVsphere
|
|
169
169
|
if vm
|
170
170
|
Chef::Log.info "machine already created: #{bootstrap_options[:vm_folder]}/#{machine_spec.name}"
|
171
171
|
else
|
172
|
-
vm = clone_vm(bootstrap_options)
|
172
|
+
vm = clone_vm(action_handler, bootstrap_options)
|
173
173
|
end
|
174
174
|
|
175
175
|
machine_spec.location = {
|
@@ -387,7 +387,7 @@ module ChefMetalVsphere
|
|
387
387
|
bootstrap_options
|
388
388
|
end
|
389
389
|
|
390
|
-
def clone_vm(bootstrap_options)
|
390
|
+
def clone_vm(action_handler, bootstrap_options)
|
391
391
|
vm_name = bootstrap_options[:name]
|
392
392
|
datacenter = bootstrap_options[:datacenter]
|
393
393
|
template_folder = bootstrap_options[:template_folder]
|
@@ -398,7 +398,7 @@ module ChefMetalVsphere
|
|
398
398
|
|
399
399
|
vm_template = find_vm(datacenter, template_folder, template_name) or raise("vSphere VM Template not found [#{template_folder}/#{template_name}]")
|
400
400
|
|
401
|
-
do_vm_clone(datacenter, vm_template, vm_name, bootstrap_options)
|
401
|
+
do_vm_clone(action_handler, datacenter, vm_template, vm_name, bootstrap_options)
|
402
402
|
end
|
403
403
|
|
404
404
|
def machine_for(machine_spec, machine_options, vm = nil)
|
@@ -96,7 +96,7 @@ module ChefMetalVsphere
|
|
96
96
|
connectable = RbVmomi::VIM::VirtualDeviceConnectInfo(
|
97
97
|
:allowGuestControl => true,
|
98
98
|
:connected => true,
|
99
|
-
:startConnected =>
|
99
|
+
:startConnected => operation.value == 'edit')
|
100
100
|
device = RbVmomi::VIM::VirtualVmxnet3(
|
101
101
|
:backing => nic_backing_info,
|
102
102
|
:deviceInfo => RbVmomi::VIM::Description(:label => network_label, :summary => network_name),
|
@@ -111,7 +111,7 @@ module ChefMetalVsphere
|
|
111
111
|
vm.config.hardware.device.select {|d| d.is_a?(RbVmomi::VIM::VirtualEthernetCard)}
|
112
112
|
end
|
113
113
|
|
114
|
-
def do_vm_clone(dc_name, vm_template, vm_name, options)
|
114
|
+
def do_vm_clone(action_handler, dc_name, vm_template, vm_name, options)
|
115
115
|
deviceAdditions = []
|
116
116
|
|
117
117
|
clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(
|
@@ -121,7 +121,7 @@ module ChefMetalVsphere
|
|
121
121
|
config: RbVmomi::VIM.VirtualMachineConfigSpec(:deviceChange => Array.new)
|
122
122
|
)
|
123
123
|
|
124
|
-
clone_spec.customization = customization_options_from(vm_template, vm_name, options)
|
124
|
+
clone_spec.customization = customization_options_from(action_handler, vm_template, vm_name, options)
|
125
125
|
|
126
126
|
unless options[:annotation].to_s.nil?
|
127
127
|
clone_spec.config.annotation = options[:annotation]
|
@@ -136,7 +136,7 @@ module ChefMetalVsphere
|
|
136
136
|
end
|
137
137
|
|
138
138
|
unless options[:network_name].nil?
|
139
|
-
deviceAdditions, changes = network_device_changes(vm_template, options)
|
139
|
+
deviceAdditions, changes = network_device_changes(action_handler, vm_template, options)
|
140
140
|
clone_spec.config.deviceChange = changes
|
141
141
|
end
|
142
142
|
|
@@ -199,7 +199,7 @@ module ChefMetalVsphere
|
|
199
199
|
)
|
200
200
|
end
|
201
201
|
|
202
|
-
def network_device_changes(vm_template, options)
|
202
|
+
def network_device_changes(action_handler, vm_template, options)
|
203
203
|
additions = []
|
204
204
|
changes = []
|
205
205
|
networks=options[:network_name]
|
@@ -214,13 +214,13 @@ module ChefMetalVsphere
|
|
214
214
|
if card = cards.shift
|
215
215
|
key = card.key
|
216
216
|
operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('edit')
|
217
|
-
|
217
|
+
action_handler.report_progress "changing template nic for #{networks[i]}"
|
218
218
|
changes.push(
|
219
219
|
network_adapter_for(operation, networks[i], "Network Adapter #{i+1}", key))
|
220
220
|
else
|
221
221
|
key = key + 1
|
222
222
|
operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('add')
|
223
|
-
|
223
|
+
action_handler.report_progress "will be adding nic for #{networks[i]}"
|
224
224
|
additions.push(
|
225
225
|
network_adapter_for(operation, networks[i], "Network Adapter #{i+1}", key))
|
226
226
|
end
|
@@ -233,7 +233,7 @@ module ChefMetalVsphere
|
|
233
233
|
baseEntity.find { |f| f.info.name == datastore_name } or raise "no such datastore #{datastore_name}"
|
234
234
|
end
|
235
235
|
|
236
|
-
def customization_options_from(vm_template, vm_name, options)
|
236
|
+
def customization_options_from(action_handler, vm_template, vm_name, options)
|
237
237
|
if options.has_key?(:customization_spec)
|
238
238
|
if(options[:customization_spec].is_a?(Hash))
|
239
239
|
cust_options = options[:customization_spec]
|
@@ -243,12 +243,12 @@ module ChefMetalVsphere
|
|
243
243
|
raise ArgumentError, "ip and subnetMask is required for static ip" unless cust_options[:ipsettings].key?(:ip) and
|
244
244
|
cust_options[:ipsettings].key?(:subnetMask)
|
245
245
|
cust_ip_settings = RbVmomi::VIM::CustomizationIPSettings.new(cust_options[:ipsettings])
|
246
|
-
|
246
|
+
action_handler.report_progress "customizing #{vm_name} with static IP #{cust_options[:ipsettings][:ip]}"
|
247
247
|
cust_ip_settings.ip = RbVmomi::VIM::CustomizationFixedIp(:ipAddress => cust_options[:ipsettings][:ip])
|
248
248
|
end
|
249
249
|
cust_domain = cust_options[:domain]
|
250
250
|
if cust_ip_settings.nil?
|
251
|
-
|
251
|
+
action_handler.report_progress "customizing #{vm_name} with dynamic IP"
|
252
252
|
cust_ip_settings= RbVmomi::VIM::CustomizationIPSettings.new(:ip => RbVmomi::VIM::CustomizationDhcpIpGenerator.new())
|
253
253
|
end
|
254
254
|
|
@@ -261,7 +261,7 @@ module ChefMetalVsphere
|
|
261
261
|
cust_timezone = cust_options[:time_zone]
|
262
262
|
|
263
263
|
if vm_template.config.guestId.start_with?('win')
|
264
|
-
cust_prep = windows_prep_for(options, vm_name)
|
264
|
+
cust_prep = windows_prep_for(action_handler, options, vm_name)
|
265
265
|
else
|
266
266
|
cust_prep = RbVmomi::VIM::CustomizationLinuxPrep.new(
|
267
267
|
:domain => cust_domain,
|
@@ -280,7 +280,7 @@ module ChefMetalVsphere
|
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
283
|
-
def windows_prep_for(options, vm_name)
|
283
|
+
def windows_prep_for(action_handler, options, vm_name)
|
284
284
|
cust_options = options[:customization_spec]
|
285
285
|
cust_runonce = RbVmomi::VIM::CustomizationGuiRunOnce.new(
|
286
286
|
:commandList => [
|
@@ -288,15 +288,27 @@ module ChefMetalVsphere
|
|
288
288
|
'winrm set winrm/config/service/auth @{Basic="true"}',
|
289
289
|
'winrm set winrm/config/service @{AllowUnencrypted="true"}',
|
290
290
|
'shutdown -l'])
|
291
|
-
|
292
|
-
|
293
|
-
cust_password = RbVmomi::VIM::CustomizationPassword(
|
291
|
+
|
292
|
+
cust_login_password = RbVmomi::VIM::CustomizationPassword(
|
294
293
|
:plainText => true,
|
295
294
|
:value => options[:ssh][:password])
|
295
|
+
if cust_options.has_key?(:domain) and cust_options[:domain] != 'local'
|
296
|
+
cust_domain_password = RbVmomi::VIM::CustomizationPassword(
|
297
|
+
:plainText => true,
|
298
|
+
:value => cust_options[:domainAdminPassword])
|
299
|
+
cust_id = RbVmomi::VIM::CustomizationIdentification.new(
|
300
|
+
:joinDomain => cust_options[:domain],
|
301
|
+
:domainAdmin => cust_options[:domainAdmin],
|
302
|
+
:domainAdminPassword => cust_domain_password)
|
303
|
+
action_handler.report_progress "joining domain #{cust_options[:domain]} with user: #{cust_options[:domainAdmin]}"
|
304
|
+
else
|
305
|
+
cust_id = RbVmomi::VIM::CustomizationIdentification.new(
|
306
|
+
:joinWorkgroup => 'WORKGROUP')
|
307
|
+
end
|
296
308
|
cust_gui_unattended = RbVmomi::VIM::CustomizationGuiUnattended.new(
|
297
309
|
:autoLogon => true,
|
298
310
|
:autoLogonCount => 1,
|
299
|
-
:password =>
|
311
|
+
:password => cust_login_password,
|
300
312
|
:timeZone => cust_options[:win_time_zone])
|
301
313
|
cust_userdata = RbVmomi::VIM::CustomizationUserData.new(
|
302
314
|
:computerName => hostname_from(cust_options, vm_name),
|
@@ -65,7 +65,14 @@ describe "vsphere_driver" do
|
|
65
65
|
expect(@vm.config.instanceUuid).to eq(@machine_spec.location['server_id'])
|
66
66
|
end
|
67
67
|
it "has the correct name" do
|
68
|
-
|
68
|
+
now = Time.now.utc
|
69
|
+
trimmed_name = @vm.config.guestId.start_with?('win') ? @vm_name.byteslice(0,15) : @vm_name
|
70
|
+
expected_name="#{trimmed_name}.#{@metal_config[:machine_options][:bootstrap_options][:customization_spec][:domain]}"
|
71
|
+
until (Time.now.utc - now) > 30 || (@vm.guest.hostName == expected_name) do
|
72
|
+
print "."
|
73
|
+
sleep 5
|
74
|
+
end
|
75
|
+
expect(@vm.guest.hostName).to eq(expected_name)
|
69
76
|
end
|
70
77
|
it "has the correct number of CPUs" do
|
71
78
|
expect(@vm.config.hardware.numCPU).to eq(@metal_config[:machine_options][:bootstrap_options][:num_cpus])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clc-chef-metal-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CenturyLink Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|