chef-provisioning-vsphere 0.6.0 → 0.7.0

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: 6a4045ecb221ec02220b2e3c0849e97cf1bb1c57
4
- data.tar.gz: 23dde05998a38c711916deb319f5b98ae506daba
3
+ metadata.gz: 447c1e20f65a8624c0321e979bd167d749bfdc99
4
+ data.tar.gz: 0d2642fb145e478ed4bb941463ac918eae3b5e3d
5
5
  SHA512:
6
- metadata.gz: ac9cedbb382f9d21793a70d29f41937fee9abf36fb080fa7a888203d65a1e0f693b05cae3c2006a62ec976dc8391fe0dc67c65a27d358d51c6237f2ec8d2ff6a
7
- data.tar.gz: 4327d561d58097f0abeb4d254b9bdfefd024784f784860617317253cbf2fa091722e0637e4a85df5bfd46e95621db89ad12719f432dae72d02e80aacfa7dea93
6
+ metadata.gz: 819875ac593906e1d8570f823471d05747baa54ef9689086de8aee21cc093c7df87cee7835618590b8a585d87ba764028a7d96fc8e2f69559be8fceea4825d96
7
+ data.tar.gz: 702b9dcd0d2c953cd5034a03ae70e6706c48eb58af12076b8c10ba32e6b2fc5ee5debaa376081e664d7c2bb64f0504968b43d7670fc6247cec98b2d8431e89c5
data/README.md CHANGED
@@ -93,7 +93,7 @@ This will use chef-zero and needs no chef server (only works for ssh). Note that
93
93
  - `[:convergence_options][:install_sh_url]` - the bach script to install chef client on linux (defaults to latest)
94
94
  - `[:customization_spec][:ipsettings][:ip]` static ip to assign to machine
95
95
  - `[:customization_spec][:ipsettings][:subnetMask]` - subnet to use
96
- - `[:customization_spec][:ipsettings][:gateway]` - gateway to use
96
+ - `[:customization_spec][:ipsettings][:gateway]` - array of possible gateways to use (this will most often be an array of 1)
97
97
  - `[:customization_spec][:ipsettings][:dnsServerList]` - array of DNS servers to use
98
98
  - `[:customization_spec][:domain]` - domain to use (if not 'local' on a windows machine it will attempt to domain join)
99
99
  - `[:customization_spec][:domainAdmin]` - domain admin account to use for domain join on windows (should be `{user name}`@`{domain}`)
@@ -180,6 +180,48 @@ knife cookbook upload my_cookbook
180
180
  chef-client -o 'my_cookbook::provision' -c .chef/knife.rb
181
181
  ```
182
182
 
183
+ ### Prefix all SSH commands with 'sudo ', for installing on hosts where options[:bootstrap_options][:ssh][:user] is not 'root'. The user must have 'NOPASSWD:ALL' in /etc/sudoers. This is compatible with chef-provisioning-fog functionality
184
+
185
+ ```
186
+ chef_gem 'chef-provisioning-vsphere' do
187
+ action :install
188
+ compile_time true
189
+ end
190
+
191
+ require 'chef/provisioning/vsphere_driver'
192
+
193
+ with_vsphere_driver host: 'vcenter-host-name',
194
+ insecure: true,
195
+ user: 'you_user_name',
196
+ password: 'your_mothers_maiden_name'
197
+
198
+ with_machine_options :bootstrap_options => {
199
+ use_linked_clone: true,
200
+ num_cpus: 2,
201
+ memory_mb: 4096,
202
+ network_name: ["vlan_20_172.21.20"],
203
+ datacenter: 'datacenter_name',
204
+ resource_pool: 'cluster',
205
+ template_name: 'path to template',
206
+ customization_spec: {
207
+ ipsettings: {
208
+ dnsServerList: ['1.2.3.31','1.2.3.41']
209
+ },
210
+ :domain => 'local'
211
+ }
212
+ :ssh => {
213
+ :user => 'root',
214
+ :password => 'password',
215
+ :paranoid => false,
216
+ }
217
+ },
218
+ :sudo => true
219
+
220
+ machine "my_machine_name" do
221
+ run_list ['my_cookbook::default']
222
+ end
223
+
224
+ ```
183
225
  ## Kitchen Driver
184
226
 
185
227
  This chef-provisioning-driver comes with a test-kitchen driver. Here are example driver options you can add to your `kitchen.yml`.
@@ -379,7 +379,7 @@ module ChefProvisioningVsphere
379
379
  if vm
380
380
  action_handler.perform_action "Delete VM [#{vm.parent.name}/#{vm.name}]" do
381
381
  begin
382
- vm.PowerOffVM_Task.wait_for_completion unless vm.runtime.powerState == 'poweredOff'
382
+ vsphere_helper.stop_vm(vm, machine_options[:stop_timeout])
383
383
  vm.Destroy_Task.wait_for_completion
384
384
  rescue RbVmomi::Fault => fault
385
385
  raise fault unless fault.fault.class.wsdl_name == "ManagedObjectNotFound"
@@ -397,7 +397,7 @@ module ChefProvisioningVsphere
397
397
  vm = vm_for(machine_spec)
398
398
  if vm
399
399
  action_handler.perform_action "Shutdown guest OS and power off VM [#{vm.parent.name}/#{vm.name}]" do
400
- vsphere_helper.stop_vm(vm)
400
+ vsphere_helper.stop_vm(vm, machine_options[:stop_timeout])
401
401
  end
402
402
  end
403
403
  end
@@ -638,7 +638,7 @@ module ChefProvisioningVsphere
638
638
  host,
639
639
  ssh_user,
640
640
  options,
641
- {},
641
+ @config[:machine_options][:sudo] ? {:prefix => 'sudo '} : {},
642
642
  config
643
643
  )
644
644
  end
@@ -1,3 +1,3 @@
1
1
  module ChefProvisioningVsphere
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
@@ -47,13 +47,6 @@ module ChefProvisioningVsphere
47
47
  )
48
48
  end
49
49
 
50
- def vm_stopped?(vm)
51
- return true if vm.nil?
52
- state = vm.runtime.powerState
53
- return false unless state == 'poweredOff'
54
- return false
55
- end
56
-
57
50
  def start_vm(vm, wait_on_port = 22)
58
51
  state = vm.runtime.powerState
59
52
  unless state == 'poweredOn'
@@ -61,10 +54,15 @@ module ChefProvisioningVsphere
61
54
  end
62
55
  end
63
56
 
64
- def stop_vm(vm)
57
+ def stop_vm(vm, timeout = 600)
58
+ start = Time.now.utc
65
59
  begin
66
60
  vm.ShutdownGuest
67
- sleep 2 until vm.runtime.powerState == 'poweredOff'
61
+ until (Time.now.utc - start) > timeout ||
62
+ vm.runtime.powerState == 'poweredOff' do
63
+ print '.'
64
+ sleep 2
65
+ end
68
66
  rescue
69
67
  vm.PowerOffVM_Task.wait_for_completion
70
68
  end
@@ -12,6 +12,7 @@ module Kitchen
12
12
  default_config :machine_options,
13
13
  :start_timeout => 600,
14
14
  :create_timeout => 600,
15
+ :stop_timeout => 600,
15
16
  :ready_timeout => 90,
16
17
  :bootstrap_options => {
17
18
  :use_linked_clone => true,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CenturyLink Cloud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbvmomi