chef-provisioning-vagrant 0.12.0 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a70be7cfd7be15988ef1d9ec3037d9bab25400ac
4
- data.tar.gz: e08a613b0fee6542b061736d8e7ae80f8b4da4bc
3
+ metadata.gz: 51aaabfb2c9bf2295b7f4ad7ae9541259865c388
4
+ data.tar.gz: ae303f41cd3962f58d76f2f18e635b982c111906
5
5
  SHA512:
6
- metadata.gz: 4f35ed9accff44e6c20abc6584b984277691c4c7aa861d0e6ca4062fc86b6e394671b9cc66d89b203f05760fe663b023639f39b0b7d3e5080f1673330cf81e6e
7
- data.tar.gz: b9c8668ea605e09cb1c5619f73f8b9a333b32cc3f6bb54eae6f54aad3f2b262d71a8cc55860da3c84259f2738482dc98d0024f455aec0cafcaad89e02d3929c8
6
+ metadata.gz: d07fc97faa614569d7287dc7d32b62f2f89be64b92a914920ecf56ac1f9845b32f20c521ae02a6dc19dffd3316969e2ee1c6f5d6e857a02ea97e23add1b331dc
7
+ data.tar.gz: abeb7435edda7780aa399a4ec4f75785ffc9049e07feceed5365b61b22f5bc68b81541a83ea96d7d0620a337b4437f0681209238b5d51706a90aab8f27ef8aa8
data/Gemfile CHANGED
@@ -1,3 +1,11 @@
1
1
  source "https://rubygems.org"
2
2
  gemfile
3
3
  gemspec
4
+
5
+ group :development do
6
+ gem "chef"
7
+ gem "chefstyle"
8
+ gem "rspec"
9
+ gem "rake"
10
+ gem "github_changelog_generator", git: "https://github.com/chef/github-changelog-generator"
11
+ end
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- require 'bundler'
2
- require 'bundler/gem_tasks'
1
+ require "bundler"
2
+ require "bundler/gem_tasks"
3
3
 
4
4
  task :spec do
5
- require File.expand_path('spec/run')
5
+ require File.expand_path("spec/run")
6
6
  end
7
7
 
8
8
  require "github_changelog_generator/task"
@@ -1,28 +1,23 @@
1
- $:.unshift(File.dirname(__FILE__) + '/lib')
2
- require 'chef/provisioning/vagrant_driver/version'
1
+ $:.unshift(File.dirname(__FILE__) + "/lib")
2
+ require "chef/provisioning/vagrant_driver/version"
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = 'chef-provisioning-vagrant'
5
+ s.name = "chef-provisioning-vagrant"
6
6
  s.version = Chef::Provisioning::VagrantDriver::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
- s.extra_rdoc_files = ['README.md', 'LICENSE' ]
9
- s.summary = 'Driver for creating Vagrant instances in Chef Provisioning.'
8
+ s.extra_rdoc_files = ["README.md", "LICENSE" ]
9
+ s.summary = "Driver for creating Vagrant instances in Chef Provisioning."
10
10
  s.description = s.summary
11
- s.author = 'John Keiser'
12
- s.email = 'jkeiser@chef.io'
13
- s.homepage = 'https://github.com/chef/chef-provisioning-vagrant'
11
+ s.author = "John Keiser"
12
+ s.email = "jkeiser@chef.io"
13
+ s.homepage = "https://github.com/chef/chef-provisioning-vagrant"
14
14
 
15
- s.add_dependency 'chef-provisioning'
16
-
17
- s.add_development_dependency 'chef'
18
- s.add_development_dependency 'rspec'
19
- s.add_development_dependency 'rake'
20
- s.add_development_dependency 'github_changelog_generator'
15
+ s.add_dependency "chef-provisioning"
21
16
 
22
17
  s.bindir = "bin"
23
- s.executables = %w( )
18
+ s.executables = %w{ }
24
19
 
25
- s.require_path = 'lib'
26
- s.files = %w(Gemfile Rakefile LICENSE README.md) + Dir.glob("*.gemspec") +
27
- Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
20
+ s.require_path = "lib"
21
+ s.files = %w{Gemfile Rakefile LICENSE README.md} + Dir.glob("*.gemspec") +
22
+ Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
28
23
  end
Binary file
Binary file
@@ -1,5 +1,5 @@
1
- require 'chef/provider/lwrp_base'
2
- require 'chef/mixin/shell_out'
1
+ require "chef/provider/lwrp_base"
2
+ require "chef/mixin/shell_out"
3
3
 
4
4
  class Chef::Provider::VagrantBox < Chef::Provider::LWRPBase
5
5
  provides :vagrant_box
@@ -1,5 +1,5 @@
1
- require 'chef/provider/lwrp_base'
2
- require 'cheffish'
1
+ require "chef/provider/lwrp_base"
2
+ require "cheffish"
3
3
 
4
4
  class Chef::Provider::VagrantCluster < Chef::Provider::LWRPBase
5
5
  provides :vagrant_cluster
@@ -13,7 +13,7 @@ class Chef::Provider::VagrantCluster < Chef::Provider::LWRPBase
13
13
  the_base_path = new_resource.path
14
14
  Cheffish.inline_resource(self, :create) do
15
15
  directory the_base_path
16
- file ::File.join(the_base_path, 'Vagrantfile') do
16
+ file ::File.join(the_base_path, "Vagrantfile") do
17
17
  content <<EOM
18
18
  Dir.glob('#{::File.join(the_base_path, '*.vm')}') do |vm_file|
19
19
  eval(IO.read(vm_file), nil, vm_file)
@@ -26,7 +26,7 @@ EOM
26
26
  action :delete do
27
27
  the_base_path = new_resource.path
28
28
  Cheffish.inline_resource(self, :delete) do
29
- file ::File.join(the_base_path, 'Vagrantfile') do
29
+ file ::File.join(the_base_path, "Vagrantfile") do
30
30
  action :delete
31
31
  end
32
32
  directory the_base_path do
@@ -1,3 +1,3 @@
1
- require 'chef/provisioning/vagrant_driver/driver'
1
+ require "chef/provisioning/vagrant_driver/driver"
2
2
 
3
3
  Chef::Provisioning.register_driver_class("vagrant", Chef::Provisioning::VagrantDriver::Driver)
@@ -1,20 +1,20 @@
1
- require 'chef/provisioning'
2
- require 'chef/resource/vagrant_cluster'
3
- require 'chef/provider/vagrant_cluster'
4
- require 'chef/resource/vagrant_box'
5
- require 'chef/provider/vagrant_box'
6
- require 'chef/provisioning/vagrant_driver/driver'
1
+ require "chef/provisioning"
2
+ require "chef/resource/vagrant_cluster"
3
+ require "chef/provider/vagrant_cluster"
4
+ require "chef/resource/vagrant_box"
5
+ require "chef/provider/vagrant_box"
6
+ require "chef/provisioning/vagrant_driver/driver"
7
7
 
8
8
  class Chef
9
9
  module Provisioning
10
10
  module VagrantDriver
11
11
  def self.with_vagrant_box(run_context, box_name, vagrant_options = {}, &block)
12
12
  if box_name.is_a?(Chef::Resource::VagrantBox)
13
- new_options = { :vagrant_options => { 'vm.box' => box_name.name } }
14
- new_options[:vagrant_options]['vm.box_url'] = box_name.url if box_name.url
13
+ new_options = { :vagrant_options => { "vm.box" => box_name.name } }
14
+ new_options[:vagrant_options]["vm.box_url"] = box_name.url if box_name.url
15
15
  new_options[:vagrant_provider] = box_name.vagrant_provider
16
16
  else
17
- new_options = { :vagrant_options => { 'vm.box' => box_name } }
17
+ new_options = { :vagrant_options => { "vm.box" => box_name } }
18
18
  end
19
19
 
20
20
  run_context.chef_provisioning.add_machine_options(new_options, &block)
@@ -1,15 +1,15 @@
1
- require 'chef/mixin/shell_out'
2
- require 'chef/provisioning/driver'
3
- require 'chef/provisioning/machine/windows_machine'
4
- require 'chef/provisioning/machine/unix_machine'
5
- require 'chef/provisioning/convergence_strategy/install_msi'
6
- require 'chef/provisioning/convergence_strategy/install_cached'
7
- require 'chef/provisioning/convergence_strategy/install_sh'
8
- require 'chef/provisioning/transport/winrm'
9
- require 'chef/provisioning/transport/ssh'
10
- require 'chef/provisioning/vagrant_driver/version'
11
- require 'chef/resource/vagrant_cluster'
12
- require 'chef/provider/vagrant_cluster'
1
+ require "chef/mixin/shell_out"
2
+ require "chef/provisioning/driver"
3
+ require "chef/provisioning/machine/windows_machine"
4
+ require "chef/provisioning/machine/unix_machine"
5
+ require "chef/provisioning/convergence_strategy/install_msi"
6
+ require "chef/provisioning/convergence_strategy/install_cached"
7
+ require "chef/provisioning/convergence_strategy/install_sh"
8
+ require "chef/provisioning/transport/winrm"
9
+ require "chef/provisioning/transport/ssh"
10
+ require "chef/provisioning/vagrant_driver/version"
11
+ require "chef/resource/vagrant_cluster"
12
+ require "chef/provider/vagrant_cluster"
13
13
 
14
14
  class Chef
15
15
  module Provisioning
@@ -26,7 +26,7 @@ class Chef
26
26
  # should have been created with the vagrant_cluster resource.
27
27
  def initialize(driver_url, config)
28
28
  super
29
- scheme, cluster_path = driver_url.split(':', 2)
29
+ scheme, cluster_path = driver_url.split(":", 2)
30
30
  @cluster_path = cluster_path
31
31
  end
32
32
 
@@ -37,8 +37,8 @@ class Chef
37
37
  end
38
38
 
39
39
  def self.canonicalize_url(driver_url, config)
40
- scheme, cluster_path = driver_url.split(':', 2)
41
- cluster_path = File.expand_path(cluster_path || File.join(Chef::Config.config_dir, 'vms'))
40
+ scheme, cluster_path = driver_url.split(":", 2)
41
+ cluster_path = File.expand_path(cluster_path || File.join(Chef::Config.config_dir, "vms"))
42
42
  "vagrant:#{cluster_path}"
43
43
  end
44
44
 
@@ -53,20 +53,20 @@ class Chef
53
53
  if vm_file_updated || !machine_spec.location
54
54
  old_location = machine_spec.location
55
55
  machine_spec.location = {
56
- 'driver_url' => driver_url,
57
- 'driver_version' => Chef::Provisioning::VagrantDriver::VERSION,
58
- 'vm_name' => vm_name,
59
- 'vm_file_path' => vm_file_path,
60
- 'allocated_at' => Time.now.utc.to_s,
61
- 'host_node' => action_handler.host_node
56
+ "driver_url" => driver_url,
57
+ "driver_version" => Chef::Provisioning::VagrantDriver::VERSION,
58
+ "vm_name" => vm_name,
59
+ "vm_file_path" => vm_file_path,
60
+ "allocated_at" => Time.now.utc.to_s,
61
+ "host_node" => action_handler.host_node,
62
62
  }
63
- machine_spec.location['needs_reload'] = true if vm_file_updated
63
+ machine_spec.location["needs_reload"] = true if vm_file_updated
64
64
  if machine_options[:vagrant_options]
65
- %w(vm.guest winrm.host winrm.port winrm.transport winrm.username winrm.password).each do |key|
65
+ %w{vm.guest winrm.host winrm.port winrm.transport winrm.username winrm.password}.each do |key|
66
66
  machine_spec.location[key] = machine_options[:vagrant_options][key] if machine_options[:vagrant_options][key]
67
67
  end
68
68
  end
69
- machine_spec.location['chef_client_timeout'] = machine_options[:chef_client_timeout] if machine_options[:chef_client_timeout]
69
+ machine_spec.location["chef_client_timeout"] = machine_options[:chef_client_timeout] if machine_options[:chef_client_timeout]
70
70
  end
71
71
  end
72
72
 
@@ -82,9 +82,9 @@ class Chef
82
82
 
83
83
  def destroy_machine(action_handler, machine_spec, machine_options)
84
84
  if machine_spec.location
85
- vm_name = machine_spec.location['vm_name']
85
+ vm_name = machine_spec.location["vm_name"]
86
86
  current_status = vagrant_status(vm_name)
87
- if current_status != 'not created'
87
+ if current_status != "not created"
88
88
  action_handler.perform_action "run vagrant destroy -f #{vm_name} (status was '#{current_status}')" do
89
89
  result = shell_out("vagrant destroy -f #{vm_name}", :cwd => cluster_path)
90
90
  if result.exitstatus != 0
@@ -96,7 +96,7 @@ class Chef
96
96
  convergence_strategy_for(machine_spec, machine_options).
97
97
  cleanup_convergence(action_handler, machine_spec)
98
98
 
99
- vm_file_path = machine_spec.location['vm_file_path']
99
+ vm_file_path = machine_spec.location["vm_file_path"]
100
100
  Chef::Provisioning.inline_resource(action_handler) do
101
101
  file vm_file_path do
102
102
  action :delete
@@ -107,9 +107,9 @@ class Chef
107
107
 
108
108
  def stop_machine(action_handler, machine_spec, machine_options)
109
109
  if machine_spec.location
110
- vm_name = machine_spec.location['vm_name']
110
+ vm_name = machine_spec.location["vm_name"]
111
111
  current_status = vagrant_status(vm_name)
112
- if current_status == 'running'
112
+ if current_status == "running"
113
113
  action_handler.perform_action "run vagrant halt #{vm_name} (status was '#{current_status}')" do
114
114
  result = shell_out("vagrant halt #{vm_name}", :cwd => cluster_path)
115
115
  if result.exitstatus != 0
@@ -137,9 +137,9 @@ class Chef
137
137
  all_outputs = {}
138
138
  specs_and_options.each_key do |spec|
139
139
  if spec.location
140
- vm_name = spec.location['vm_name']
140
+ vm_name = spec.location["vm_name"]
141
141
  current_status = vagrant_status(vm_name)
142
- if current_status != 'not created'
142
+ if current_status != "not created"
143
143
  all_names.push(vm_name)
144
144
  all_status.push(current_status)
145
145
  end
@@ -158,7 +158,7 @@ class Chef
158
158
  specs_and_options.each_pair do |spec, options|
159
159
  convergence_strategy_for(spec, options).cleanup_convergence(action_handler, spec)
160
160
 
161
- vm_file_path = spec.location['vm_file_path']
161
+ vm_file_path = spec.location["vm_file_path"]
162
162
  Chef::Provisioning.inline_resource(action_handler) do
163
163
  file vm_file_path do
164
164
  action :delete
@@ -172,9 +172,9 @@ class Chef
172
172
  all_names = []
173
173
  specs_and_options.each_key do |spec|
174
174
  if spec.location
175
- vm_name = spec.location['vm_name']
175
+ vm_name = spec.location["vm_name"]
176
176
  current_status = vagrant_status(vm_name)
177
- if current_status == 'running'
177
+ if current_status == "running"
178
178
  all_names.push(vm_name)
179
179
  end
180
180
  end
@@ -192,8 +192,8 @@ class Chef
192
192
 
193
193
  # Used by vagrant_cluster and machine to get the string used to configure vagrant
194
194
  def self.vagrant_config_string(vagrant_config, variable, line_prefix)
195
- hostname = name.gsub(/[^A-Za-z0-9\-]/, '-')
196
- result = ''
195
+ hostname = name.gsub(/[^A-Za-z0-9\-]/, "-")
196
+ result = ""
197
197
  vagrant_config.each_pair do |key, value|
198
198
  result += "#{line_prefix}#{variable}.#{key} = #{value.inspect}\n"
199
199
  end
@@ -213,17 +213,16 @@ class Chef
213
213
  end
214
214
  end
215
215
 
216
-
217
216
  def create_vm_file(action_handler, vm_name, vm_file_path, machine_options)
218
217
  # Determine contents of vm file
219
218
  vm_file_content = "Vagrant.configure('2') do |outer_config|\n"
220
219
  vm_file_content << " outer_config.vm.define #{vm_name.inspect} do |config|\n"
221
- merged_vagrant_options = { 'vm.hostname' => vm_name }
220
+ merged_vagrant_options = { "vm.hostname" => vm_name }
222
221
  if machine_options[:vagrant_options]
223
222
  merged_vagrant_options = Cheffish::MergedConfig.new(machine_options[:vagrant_options], merged_vagrant_options)
224
223
  end
225
224
  merged_vagrant_options.each_pair do |key, value|
226
- if key == 'vm.network'
225
+ if key == "vm.network"
227
226
  vm_networks = [value].flatten
228
227
  vm_networks.each do |network|
229
228
  vm_file_content << " config.#{key}(#{network})\n"
@@ -245,17 +244,17 @@ class Chef
245
244
  end
246
245
 
247
246
  def start_machine(action_handler, machine_spec, machine_options)
248
- vm_name = machine_spec.location['vm_name']
249
- vm_provider = machine_options.has_key?(:vagrant_provider) ? machine_options[:vagrant_provider] : 'virtualbox'
250
- up_timeout = machine_options[:up_timeout] || 10*60
247
+ vm_name = machine_spec.location["vm_name"]
248
+ vm_provider = machine_options.has_key?(:vagrant_provider) ? machine_options[:vagrant_provider] : "virtualbox"
249
+ up_timeout = machine_options[:up_timeout] || 10 * 60
251
250
  current_status = vagrant_status(vm_name)
252
- vm_file_updated = machine_spec.location['needs_reload']
253
- machine_spec.location['needs_reload'] = false
254
- if current_status != 'running'
251
+ vm_file_updated = machine_spec.location["needs_reload"]
252
+ machine_spec.location["needs_reload"] = false
253
+ if current_status != "running"
255
254
  # Run vagrant up if vm is not running
256
255
  action_handler.perform_action "run vagrant up #{vm_name} --provider #{vm_provider} (status was '#{current_status}')" do
257
256
  result = shell_out("vagrant up #{vm_name} --provider #{vm_provider}", :cwd => cluster_path,
258
- :timeout => up_timeout)
257
+ :timeout => up_timeout)
259
258
  if result.exitstatus != 0
260
259
  raise "vagrant up #{vm_name} --provider #{vm_provider} failed!\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
261
260
  end
@@ -265,7 +264,7 @@ class Chef
265
264
  # Run vagrant reload if vm is running and vm file changed
266
265
  action_handler.perform_action "run vagrant reload #{vm_name}" do
267
266
  result = shell_out("vagrant reload #{vm_name}", :cwd => cluster_path,
268
- :timeout => up_timeout)
267
+ :timeout => up_timeout)
269
268
  if result.exitstatus != 0
270
269
  raise "vagrant reload #{vm_name} failed!\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
271
270
  end
@@ -282,13 +281,13 @@ class Chef
282
281
  update_specs = {}
283
282
  timeouts = []
284
283
  specs_and_options.each_pair do |spec, options|
285
- vm_name = spec.location['vm_name']
284
+ vm_name = spec.location["vm_name"]
286
285
 
287
- vm_file_updated = spec.location['needs_reload']
288
- spec.location['needs_reload'] = false
286
+ vm_file_updated = spec.location["needs_reload"]
287
+ spec.location["needs_reload"] = false
289
288
 
290
289
  current_status = vagrant_status(vm_name)
291
- if current_status != 'running'
290
+ if current_status != "running"
292
291
  up_names.push(vm_name)
293
292
  up_status.push(current_status)
294
293
  up_specs[vm_name] = spec
@@ -300,14 +299,14 @@ class Chef
300
299
  end
301
300
  # Use the highest timeout, if any exist
302
301
  up_timeout = timeouts.compact.max
303
- up_timeout ||= 10*60
302
+ up_timeout ||= 10 * 60
304
303
  if up_names.length > 0
305
304
  # Run vagrant up if vm is not running
306
305
  names = up_names.join(" ")
307
306
  statuses = up_status.join(", ")
308
307
  action_handler.perform_action "run vagrant up --parallel #{names} (status was '#{statuses}')" do
309
308
  result = shell_out("vagrant up --parallel #{names}", :cwd => cluster_path,
310
- :timeout => up_timeout)
309
+ :timeout => up_timeout)
311
310
  if result.exitstatus != 0
312
311
  raise "vagrant up #{names} failed!\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
313
312
  end
@@ -319,7 +318,7 @@ class Chef
319
318
  # Run vagrant reload if vm is running and vm file changed
320
319
  action_handler.perform_action "run vagrant reload #{names}" do
321
320
  result = shell_out("vagrant reload #{names}", :cwd => cluster_path,
322
- :timeout => up_timeout)
321
+ :timeout => up_timeout)
323
322
  if result.exitstatus != 0
324
323
  raise "vagrant reload #{names} failed!\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
325
324
  end
@@ -330,12 +329,12 @@ class Chef
330
329
 
331
330
  def parse_vagrant_up(output, machine_spec)
332
331
  # Grab forwarded port info
333
- machine_spec.location['forwarded_ports'] = {}
332
+ machine_spec.location["forwarded_ports"] = {}
334
333
  in_forwarding_ports = false
335
334
  output.lines.each do |line|
336
335
  if in_forwarding_ports
337
336
  if line =~ /-- (\d+) => (\d+)/
338
- machine_spec.location['forwarded_ports'][$1] = $2
337
+ machine_spec.location["forwarded_ports"][$1] = $2
339
338
  else
340
339
  in_forwarding_ports = false
341
340
  end
@@ -349,7 +348,7 @@ class Chef
349
348
  # Grab forwarded port info
350
349
  in_forwarding_ports = {}
351
350
  all_machine_specs.each_pair do |key, spec|
352
- spec.location['forwarded_ports'] = {}
351
+ spec.location["forwarded_ports"] = {}
353
352
  in_forwarding_ports[key] = false
354
353
  end
355
354
  output.lines.each do |line|
@@ -358,7 +357,7 @@ class Chef
358
357
  if in_forwarding_ports[node_name]
359
358
  if line =~ /-- (\d+) => (\d+)/
360
359
  spec = all_machine_specs[node_name]
361
- spec.location['forwarded_ports'][$1] = $2
360
+ spec.location["forwarded_ports"][$1] = $2
362
361
  else
363
362
  in_forwarding_ports[node_name] = false
364
363
  end
@@ -369,7 +368,7 @@ class Chef
369
368
  end
370
369
 
371
370
  def machine_for(machine_spec, machine_options)
372
- if machine_spec.location['vm.guest'].to_s == 'windows'
371
+ if machine_spec.location["vm.guest"].to_s == "windows"
373
372
  Chef::Provisioning::Machine::WindowsMachine.new(machine_spec, transport_for(machine_spec),
374
373
  convergence_strategy_for(machine_spec, machine_options))
375
374
  else
@@ -379,7 +378,7 @@ class Chef
379
378
  end
380
379
 
381
380
  def convergence_strategy_for(machine_spec, machine_options)
382
- if machine_spec.location['vm.guest'].to_s == 'windows'
381
+ if machine_spec.location["vm.guest"].to_s == "windows"
383
382
  Chef::Provisioning::ConvergenceStrategy::InstallMsi.
384
383
  new(machine_options[:convergence_options], config)
385
384
  elsif machine_options[:cached_installer] == true
@@ -392,7 +391,7 @@ class Chef
392
391
  end
393
392
 
394
393
  def transport_for(machine_spec)
395
- if machine_spec.location['vm.guest'].to_s == 'windows'
394
+ if machine_spec.location["vm.guest"].to_s == "windows"
396
395
  create_winrm_transport(machine_spec)
397
396
  else
398
397
  create_ssh_transport(machine_spec)
@@ -404,23 +403,23 @@ class Chef
404
403
  if status_output =~ /^#{name}\s+(.+)\s+\((.+)\)/
405
404
  $1
406
405
  else
407
- 'not created'
406
+ "not created"
408
407
  end
409
408
  end
410
409
 
411
410
  def create_winrm_transport(machine_spec)
412
- forwarded_ports = machine_spec.location['forwarded_ports']
411
+ forwarded_ports = machine_spec.location["forwarded_ports"]
413
412
 
414
413
  # TODO IPv6 loopback? What do we do for that?
415
- hostname = machine_spec.location['winrm.host'] || '127.0.0.1'
416
- port = machine_spec.location['winrm.port'] || 5985
414
+ hostname = machine_spec.location["winrm.host"] || "127.0.0.1"
415
+ port = machine_spec.location["winrm.port"] || 5985
417
416
  port = forwarded_ports[port] if forwarded_ports[port]
418
417
  endpoint = "http://#{hostname}:#{port}/wsman"
419
- type = machine_spec.location['winrm.transport'] || :plaintext
418
+ type = machine_spec.location["winrm.transport"] || :plaintext
420
419
  options = {
421
- :user => machine_spec.location['winrm.username'] || 'vagrant',
422
- :pass => machine_spec.location['winrm.password'] || 'vagrant',
423
- :disable_sspi => true
420
+ :user => machine_spec.location["winrm.username"] || "vagrant",
421
+ :pass => machine_spec.location["winrm.password"] || "vagrant",
422
+ :disable_sspi => true,
424
423
  }
425
424
 
426
425
  Chef::Provisioning::Transport::WinRM.new(endpoint, type, options, config)
@@ -428,19 +427,19 @@ class Chef
428
427
 
429
428
  def create_ssh_transport(machine_spec)
430
429
  vagrant_ssh_config = vagrant_ssh_config_for(machine_spec)
431
- hostname = vagrant_ssh_config['HostName']
432
- username = vagrant_ssh_config['User']
430
+ hostname = vagrant_ssh_config["HostName"]
431
+ username = vagrant_ssh_config["User"]
433
432
  ssh_options = {
434
- :port => vagrant_ssh_config['Port'],
435
- :auth_methods => ['publickey'],
436
- :user_known_hosts_file => vagrant_ssh_config['UserKnownHostsFile'],
437
- :paranoid => yes_or_no(vagrant_ssh_config['StrictHostKeyChecking']),
438
- :keys => [ strip_quotes(vagrant_ssh_config['IdentityFile']) ],
439
- :keys_only => yes_or_no(vagrant_ssh_config['IdentitiesOnly'])
433
+ :port => vagrant_ssh_config["Port"],
434
+ :auth_methods => ["publickey"],
435
+ :user_known_hosts_file => vagrant_ssh_config["UserKnownHostsFile"],
436
+ :paranoid => yes_or_no(vagrant_ssh_config["StrictHostKeyChecking"]),
437
+ :keys => [ strip_quotes(vagrant_ssh_config["IdentityFile"]) ],
438
+ :keys_only => yes_or_no(vagrant_ssh_config["IdentitiesOnly"]),
440
439
  }
441
- ssh_options[:auth_methods] = %w(password) if yes_or_no(vagrant_ssh_config['PasswordAuthentication'])
440
+ ssh_options[:auth_methods] = %w{password} if yes_or_no(vagrant_ssh_config["PasswordAuthentication"])
442
441
  options = {
443
- :prefix => 'sudo '
442
+ :prefix => "sudo ",
444
443
  }
445
444
  Chef::Provisioning::Transport::SSH.new(hostname, username, ssh_options, options, config)
446
445
  end
@@ -458,7 +457,7 @@ class Chef
458
457
 
459
458
  def yes_or_no(str)
460
459
  case str
461
- when 'yes'
460
+ when "yes"
462
461
  true
463
462
  else
464
463
  false
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  module Provisioning
3
3
  module VagrantDriver
4
- VERSION = '0.12.0'
4
+ VERSION = "0.12.1"
5
5
  end
6
6
  end
7
7
  end
@@ -1,15 +1,15 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'chef/provisioning/vagrant_driver'
1
+ require "chef/resource/lwrp_base"
2
+ require "chef/provisioning/vagrant_driver"
3
3
 
4
4
  class Chef::Resource::VagrantBox < Chef::Resource::LWRPBase
5
- self.resource_name = 'vagrant_box'
5
+ self.resource_name = "vagrant_box"
6
6
 
7
7
  actions :create, :delete, :nothing
8
8
  default_action :create
9
9
 
10
10
  attribute :name, :kind_of => String, :name_attribute => true
11
11
  attribute :url, :kind_of => String
12
- attribute :vagrant_provider, :kind_of => String, :default => 'virtualbox'
12
+ attribute :vagrant_provider, :kind_of => String, :default => "virtualbox"
13
13
  attribute :driver_options, :kind_of => Hash
14
14
 
15
15
  def after_created
@@ -1,8 +1,8 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'chef/provisioning/vagrant_driver'
1
+ require "chef/resource/lwrp_base"
2
+ require "chef/provisioning/vagrant_driver"
3
3
 
4
4
  class Chef::Resource::VagrantCluster < Chef::Resource::LWRPBase
5
- self.resource_name = 'vagrant_cluster'
5
+ self.resource_name = "vagrant_cluster"
6
6
 
7
7
  actions :create, :delete, :nothing
8
8
  default_action :create
@@ -1,5 +1,5 @@
1
- require 'vagrant_support'
2
- require 'chef/provisioning'
1
+ require "vagrant_support"
2
+ require "chef/provisioning"
3
3
 
4
4
  RSpec.configure do |config|
5
5
  config.expect_with :rspec do |expectations|
@@ -7,7 +7,7 @@ module VagrantSupport
7
7
  # extend VagrantSupport
8
8
  # include VagrantConfig # optional, gives you a `chef_config` object.
9
9
 
10
- require 'cheffish/rspec/chef_run_support'
10
+ require "cheffish/rspec/chef_run_support"
11
11
 
12
12
  # when you `extend VagrantSupport`, your RSpec-context-extending-`VagrantSupport` with then
13
13
  # further `extend ChefRunSupport` to acquire all of the latter's Lucky Charms.
@@ -22,7 +22,6 @@ module VagrantSupport
22
22
  # then giving *that* to a Cheffish method which will run it for you in the context of a local chef-zero.
23
23
 
24
24
  def with_vagrant(description, *tags, &block)
25
-
26
25
  # take the block you just passed in, and make a new Proc that will call it after loading the driver...
27
26
  context_block = proc do
28
27
  vagrant_driver = Chef::Provisioning.driver_for_url("vagrant")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-vagrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
@@ -24,62 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: chef
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: github_changelog_generator
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
27
  description: Driver for creating Vagrant instances in Chef Provisioning.
84
28
  email: jkeiser@chef.io
85
29
  executables: []
@@ -93,8 +37,11 @@ files:
93
37
  - README.md
94
38
  - Rakefile
95
39
  - chef-provisioning-vagrant.gemspec
40
+ - lib/.DS_Store
41
+ - lib/chef/.DS_Store
96
42
  - lib/chef/provider/vagrant_box.rb
97
43
  - lib/chef/provider/vagrant_cluster.rb
44
+ - lib/chef/provisioning/.DS_Store
98
45
  - lib/chef/provisioning/driver_init/vagrant.rb
99
46
  - lib/chef/provisioning/vagrant_driver.rb
100
47
  - lib/chef/provisioning/vagrant_driver/driver.rb