chef-provisioning-vsphere 0.5.1 → 0.5.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9beead24ca50feddc1b634a8d2f8a5c43936c7c2
4
- data.tar.gz: 41c0ef964853c87cee814f127cc446b4ac383bd6
3
+ metadata.gz: 9429c5a2889eb0b8c3a74c2aa968e6134d6933df
4
+ data.tar.gz: e48b0fe64f042425825347c5408fbf33bcdd7fea
5
5
  SHA512:
6
- metadata.gz: adc8fd6c36acc6cbcdada4c027290049ebc623334f1eeeb7f92a2fc4b6615b9f1f25f8880ab97559d9ad2da09c9b4ef73c34758c12f25d90f14d7689f700912d
7
- data.tar.gz: dc0a7bfae64f5d89262b77d187304b81c709818e83e74d8d178c1fe5ab7b23d7233cf81dab9cc3457da9e364292b7e53eafbc48c5d88219466f40f064b4550cf
6
+ metadata.gz: 7daa42c1d264122430a212d5b2433f8ebc2e67b2e043853af254d8f9d3d6489d14d3ecb9d5b0303ce99bb6c260c2d29168e9ebd06661f7ec474f9e5b992d576b
7
+ data.tar.gz: bfffe594fc7914b88753a64f2bf527d6877fbe2e7ea92c100c91368c05523f80c5f69e8013a7a20b7e85920cb7549c678229ead358dab5185b8255b2a79cef77
@@ -110,6 +110,8 @@ module ChefProvisioningVsphere
110
110
  # -- vm_folder: name of the vSphere folder containing the VM
111
111
  #
112
112
  def allocate_machine(action_handler, machine_spec, machine_options)
113
+ merge_options! machine_options
114
+
113
115
  if machine_spec.location
114
116
  Chef::Log.warn(
115
117
  "Checking to see if #{machine_spec.location} has been created...")
@@ -142,6 +144,13 @@ module ChefProvisioningVsphere
142
144
  vm
143
145
  end
144
146
 
147
+ def merge_options!(machine_options)
148
+ @config = Cheffish::MergedConfig.new(
149
+ { machine_options: machine_options },
150
+ @config
151
+ )
152
+ end
153
+
145
154
  def add_machine_spec_location(vm, machine_spec)
146
155
  machine_spec.location = {
147
156
  'driver_url' => driver_url,
@@ -188,6 +197,8 @@ module ChefProvisioningVsphere
188
197
  end
189
198
 
190
199
  def ready_machine(action_handler, machine_spec, machine_options)
200
+ merge_options! machine_options
201
+
191
202
  vm = start_machine(action_handler, machine_spec, machine_options)
192
203
  if vm.nil?
193
204
  raise "Machine #{machine_spec.name} does not have a server "\
@@ -350,10 +361,12 @@ module ChefProvisioningVsphere
350
361
 
351
362
  # Connect to machine without acquiring it
352
363
  def connect_to_machine(machine_spec, machine_options)
364
+ merge_options! machine_options
353
365
  machine_for(machine_spec, machine_options)
354
366
  end
355
367
 
356
368
  def destroy_machine(action_handler, machine_spec, machine_options)
369
+ merge_options! machine_options
357
370
  vm = vm_for(machine_spec)
358
371
  if vm
359
372
  action_handler.perform_action "Delete VM [#{vm.parent.name}/#{vm.name}]" do
@@ -372,6 +385,7 @@ module ChefProvisioningVsphere
372
385
  end
373
386
 
374
387
  def stop_machine(action_handler, machine_spec, machine_options)
388
+ merge_options! machine_options
375
389
  vm = vm_for(machine_spec)
376
390
  if vm
377
391
  action_handler.perform_action "Shutdown guest OS and power off VM [#{vm.parent.name}/#{vm.name}]" do
@@ -381,6 +395,7 @@ module ChefProvisioningVsphere
381
395
  end
382
396
 
383
397
  def start_machine(action_handler, machine_spec, machine_options)
398
+ merge_options! machine_options
384
399
  vm = vm_for(machine_spec)
385
400
  if vm
386
401
  action_handler.perform_action "Power on VM [#{vm.parent.name}/#{vm.name}]" do
@@ -519,15 +534,21 @@ module ChefProvisioningVsphere
519
534
  require 'chef/provisioning/convergence_strategy/install_msi'
520
535
  require 'chef/provisioning/convergence_strategy/install_cached'
521
536
  require 'chef/provisioning/convergence_strategy/no_converge'
522
- # Defaults
537
+
538
+ mopts = machine_options[:convergence_options].to_hash.dup
539
+ mopts[:chef_server] = mopts[:chef_server].to_hash.dup if mopts[:chef_server]
540
+
523
541
  if !machine_spec.location
524
- return Chef::Provisioning::ConvergenceStrategy::NoConverge.new(machine_options[:convergence_options], config)
542
+ return Chef::Provisioning::ConvergenceStrategy::NoConverge.new(
543
+ mopts, config)
525
544
  end
526
545
 
527
546
  if machine_spec.location['is_windows']
528
- Chef::Provisioning::ConvergenceStrategy::InstallMsi.new(machine_options[:convergence_options], config)
547
+ Chef::Provisioning::ConvergenceStrategy::InstallMsi.new(
548
+ mopts, config)
529
549
  else
530
- Chef::Provisioning::ConvergenceStrategy::InstallCached.new(machine_options[:convergence_options], config)
550
+ Chef::Provisioning::ConvergenceStrategy::InstallCached.new(
551
+ mopts, config)
531
552
  end
532
553
  end
533
554
 
@@ -1,3 +1,3 @@
1
1
  module ChefProvisioningVsphere
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.3'
3
3
  end
@@ -74,12 +74,12 @@ module Kitchen
74
74
  chef_server = Cheffish.default_chef_server
75
75
  config[:machine_options][:convergence_options] = {:chef_server => chef_server}
76
76
  machine_spec = Chef::Provisioning.chef_managed_entry_store(chef_server).new_entry(:machine, name)
77
- driver = Chef::Provisioning.driver_for_url("vsphere://#{config[:driver_options][:host]}", config)
77
+ url = URI::VsphereUrl.from_config(@config[:driver_options]).to_s
78
+ driver = Chef::Provisioning.driver_for_url(url, config)
78
79
  action_handler = Chef::Provisioning::ActionHandler.new
79
80
  block.call(action_handler, driver, machine_spec)
80
81
  end
81
82
  end
82
-
83
83
  end
84
84
  end
85
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - CenturyLink Cloud