vagrant-windows 1.5.1 → 1.6.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/README.md +1 -1
- data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_client.rb +74 -1
- data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_solo.rb +20 -66
- data/lib/vagrant-windows/provisioners/chef_command_builder.rb +105 -0
- data/lib/vagrant-windows/version.rb +1 -1
- data/lib/vagrant-windows/windows_machine.rb +13 -0
- data/spec/vagrant-windows/chef_command_builder_spec.rb +101 -0
- data/spec/vagrant-windows/windows_machine_spec.rb +30 -0
- metadata +9 -9
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Code Climate](https://codeclimate.com/github/WinRb/vagrant-windows.png)](https://codeclimate.com/github/WinRb/vagrant-windows)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/vagrant-windows.png)](http://badge.fury.io/rb/vagrant-windows)
|
5
5
|
|
6
|
-
|
6
|
+
This [Vagrant](http://www.vagrantup.com/) plugin allows you to standup Windows guests using [WinRM](http://msdn.microsoft.com/en-us/library/aa384426\(v=vs.85\).aspx) instead of SSH. Additionally this plugin makes it easier to provision with Chef, Puppet, and the shell (PowerShell) on Windows guests.
|
7
7
|
|
8
8
|
## Getting Started
|
9
9
|
1. Install the vagrant-windows plugin.
|
data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_client.rb
CHANGED
@@ -1 +1,74 @@
|
|
1
|
-
#
|
1
|
+
require "#{Vagrant::source_root}/plugins/provisioners/chef/provisioner/chef_client"
|
2
|
+
require_relative '../../../../../helper'
|
3
|
+
require_relative '../../../../../windows_machine'
|
4
|
+
require_relative '../../../../../provisioners/chef_command_builder'
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module Chef
|
8
|
+
module Provisioner
|
9
|
+
class ChefClient < Base
|
10
|
+
|
11
|
+
include VagrantWindows::Helper
|
12
|
+
|
13
|
+
def initialize(machine, config)
|
14
|
+
super
|
15
|
+
@windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
16
|
+
@logger = Log4r::Logger.new("vagrant::provisioners::chef_client")
|
17
|
+
end
|
18
|
+
|
19
|
+
provision_on_linux = instance_method(:provision)
|
20
|
+
run_chef_client_on_linux = instance_method(:run_chef_client)
|
21
|
+
|
22
|
+
define_method(:run_chef_client) do
|
23
|
+
@windows_machine.is_windows? ? run_chef_client_on_windows() : run_chef_client_on_linux.bind(self).()
|
24
|
+
end
|
25
|
+
|
26
|
+
define_method(:provision) do
|
27
|
+
wait_if_rebooting(@windows_machine) if @windows_machine.is_windows?
|
28
|
+
provision_on_linux.bind(self).()
|
29
|
+
end
|
30
|
+
|
31
|
+
def run_chef_client_on_windows
|
32
|
+
if @config.run_list && @config.run_list.empty?
|
33
|
+
@machine.ui.warn(I18n.t("vagrant.chef_run_list_empty"))
|
34
|
+
end
|
35
|
+
|
36
|
+
#################### START - monkey patched code ####################
|
37
|
+
command_builder = ::VagrantWindows::Provisioners::ChefCommandBuilder.new(
|
38
|
+
@windows_machine, @config, :client)
|
39
|
+
|
40
|
+
command_builder.prepare_for_chef_run()
|
41
|
+
command = command_builder.run_chef_command()
|
42
|
+
###################### END - monkey patched code ####################
|
43
|
+
|
44
|
+
@config.attempts.times do |attempt|
|
45
|
+
if attempt == 0
|
46
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_client")
|
47
|
+
else
|
48
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_client_again")
|
49
|
+
end
|
50
|
+
|
51
|
+
#################### START - monkey patched code ####################
|
52
|
+
@windows_machine.reinitialize_network_shares()
|
53
|
+
###################### END - monkey patched code ####################
|
54
|
+
|
55
|
+
exit_status = @machine.communicate.execute(command, :error_check => false) do |type, data|
|
56
|
+
# Output the data with the proper color based on the stream.
|
57
|
+
color = type == :stdout ? :green : :red
|
58
|
+
|
59
|
+
@machine.env.ui.info(
|
60
|
+
data, :color => color, :new_line => false, :prefix => false)
|
61
|
+
end
|
62
|
+
|
63
|
+
# There is no need to run Chef again if it converges
|
64
|
+
return if exit_status == 0
|
65
|
+
end
|
66
|
+
|
67
|
+
# If we reached this point then Chef never converged! Error.
|
68
|
+
raise ChefError, :no_convergence
|
69
|
+
end
|
70
|
+
|
71
|
+
end # ChefSolo class
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -1,46 +1,43 @@
|
|
1
|
-
require 'tempfile'
|
2
1
|
require "#{Vagrant::source_root}/plugins/provisioners/chef/provisioner/chef_solo"
|
3
2
|
require_relative '../../../../../helper'
|
4
3
|
require_relative '../../../../../windows_machine'
|
4
|
+
require_relative '../../../../../provisioners/chef_command_builder'
|
5
5
|
|
6
6
|
module VagrantPlugins
|
7
7
|
module Chef
|
8
8
|
module Provisioner
|
9
9
|
class ChefSolo < Base
|
10
|
-
|
10
|
+
|
11
11
|
include VagrantWindows::Helper
|
12
|
+
|
13
|
+
def initialize(machine, config)
|
14
|
+
super
|
15
|
+
@windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
16
|
+
@logger = Log4r::Logger.new("vagrant::provisioners::chef_solo")
|
17
|
+
end
|
12
18
|
|
13
19
|
provision_on_linux = instance_method(:provision)
|
14
20
|
run_chef_solo_on_linux = instance_method(:run_chef_solo)
|
15
21
|
|
16
22
|
# This patch is needed until Vagrant supports chef on Windows guests
|
17
23
|
define_method(:run_chef_solo) do
|
18
|
-
is_windows? ? run_chef_solo_on_windows() : run_chef_solo_on_linux.bind(self).()
|
24
|
+
@windows_machine.is_windows? ? run_chef_solo_on_windows() : run_chef_solo_on_linux.bind(self).()
|
19
25
|
end
|
20
26
|
|
21
27
|
define_method(:provision) do
|
22
|
-
windows_machine
|
23
|
-
wait_if_rebooting(windows_machine) if is_windows?
|
28
|
+
wait_if_rebooting(@windows_machine) if @windows_machine.is_windows?
|
24
29
|
provision_on_linux.bind(self).()
|
25
30
|
end
|
26
31
|
|
27
32
|
def run_chef_solo_on_windows
|
28
|
-
# create cheftaskrun.ps1 that the scheduled task will invoke when run
|
29
|
-
render_file_and_upload("cheftaskrun.ps1", chef_script_options[:chef_task_run_ps1], :options => chef_script_options)
|
30
|
-
|
31
|
-
# create cheftask.xml that the scheduled task will be created with
|
32
|
-
render_file_and_upload("cheftask.xml", chef_script_options[:chef_task_xml], :options => chef_script_options)
|
33
|
-
|
34
|
-
# create cheftask.ps1 that will immediately invoke the scheduled task and wait for completion
|
35
|
-
render_file_and_upload("cheftask.ps1", chef_script_options[:chef_task_ps1], :options => chef_script_options)
|
36
33
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
34
|
+
#################### START - monkey patched code ####################
|
35
|
+
command_builder = ::VagrantWindows::Provisioners::ChefCommandBuilder.new(
|
36
|
+
@windows_machine, @config, :solo)
|
37
|
+
|
38
|
+
command_builder.prepare_for_chef_run()
|
39
|
+
command = command_builder.run_chef_command()
|
40
|
+
###################### END - monkey patched code ####################
|
44
41
|
|
45
42
|
@config.attempts.times do |attempt|
|
46
43
|
if attempt == 0
|
@@ -49,9 +46,9 @@ module VagrantPlugins
|
|
49
46
|
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_solo_again")
|
50
47
|
end
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
#################### START - monkey patched code ####################
|
50
|
+
@windows_machine.reinitialize_network_shares()
|
51
|
+
###################### END - monkey patched code ####################
|
55
52
|
|
56
53
|
exit_status = @machine.communicate.execute(command, :error_check => false) do |type, data|
|
57
54
|
# Output the data with the proper color based on the stream.
|
@@ -69,49 +66,6 @@ module VagrantPlugins
|
|
69
66
|
raise ChefError, :no_convergence
|
70
67
|
end
|
71
68
|
|
72
|
-
def render_file_and_upload(script_name, dest_file, options)
|
73
|
-
script_contents = VagrantWindows.load_script_template(script_name, options)
|
74
|
-
|
75
|
-
# render cheftaskrun.ps1 to local temp file
|
76
|
-
script_local = Tempfile.new(script_name)
|
77
|
-
IO.write(script_local, script_contents)
|
78
|
-
|
79
|
-
# upload cheftaskrun.ps1 file
|
80
|
-
@machine.communicate.upload(script_local, dest_file)
|
81
|
-
end
|
82
|
-
|
83
|
-
def chef_script_options
|
84
|
-
if @chef_script_options.nil?
|
85
|
-
command_env = @config.binary_env ? "#{@config.binary_env} " : ""
|
86
|
-
command_args = @config.arguments ? " #{@config.arguments}" : ""
|
87
|
-
chef_solo_path = win_friendly_path(File.join(@config.provisioning_path, 'solo.rb'))
|
88
|
-
chef_dna_path = win_friendly_path(File.join(@config.provisioning_path, 'dna.json'))
|
89
|
-
|
90
|
-
chef_arguments = "-c #{chef_solo_path} "
|
91
|
-
chef_arguments << "-j #{chef_dna_path} "
|
92
|
-
chef_arguments << "#{command_args}"
|
93
|
-
|
94
|
-
@chef_script_options = {
|
95
|
-
:user => @machine.config.winrm.username,
|
96
|
-
:pass => @machine.config.winrm.password,
|
97
|
-
:chef_arguments => chef_arguments,
|
98
|
-
:chef_task_xml => win_friendly_path("#{@config.provisioning_path}/cheftask.xml"),
|
99
|
-
:chef_task_running => win_friendly_path("#{@config.provisioning_path}/cheftask.running"),
|
100
|
-
:chef_task_exitcode => win_friendly_path("#{@config.provisioning_path}/cheftask.exitcode"),
|
101
|
-
:chef_task_ps1 => win_friendly_path("#{@config.provisioning_path}/cheftask.ps1"),
|
102
|
-
:chef_task_run_ps1 => win_friendly_path("#{@config.provisioning_path}/cheftaskrun.ps1"),
|
103
|
-
:chef_stdout_log => win_friendly_path("#{@config.provisioning_path}/chef-solo.log"),
|
104
|
-
:chef_stderr_log => win_friendly_path("#{@config.provisioning_path}/chef-solo.err.log"),
|
105
|
-
:chef_binary_path => win_friendly_path("#{command_env}#{chef_binary_path("chef-solo")}")
|
106
|
-
}
|
107
|
-
end
|
108
|
-
@chef_script_options
|
109
|
-
end
|
110
|
-
|
111
|
-
def is_windows?
|
112
|
-
VagrantWindows::WindowsMachine.is_windows?(@machine)
|
113
|
-
end
|
114
|
-
|
115
69
|
end # ChefSolo class
|
116
70
|
end
|
117
71
|
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require_relative '../helper'
|
3
|
+
require_relative '../windows_machine'
|
4
|
+
|
5
|
+
module VagrantWindows
|
6
|
+
module Provisioners
|
7
|
+
|
8
|
+
# Builds scripts and ultimately the command to execute Chef solo or Chef client
|
9
|
+
# on Windows guests using a scheduled task.
|
10
|
+
class ChefCommandBuilder
|
11
|
+
|
12
|
+
include VagrantWindows::Helper
|
13
|
+
|
14
|
+
def initialize(windows_machine, chef_config, client_type)
|
15
|
+
@windows_machine = windows_machine
|
16
|
+
@config = chef_config
|
17
|
+
|
18
|
+
if client_type != :solo && client_type != :client
|
19
|
+
raise 'Invalid client_type, expected solo or client'
|
20
|
+
end
|
21
|
+
|
22
|
+
@client_type = client_type
|
23
|
+
end
|
24
|
+
|
25
|
+
def prepare_for_chef_run()
|
26
|
+
options = create_chef_options()
|
27
|
+
|
28
|
+
# create cheftaskrun.ps1 that the scheduled task will invoke when run
|
29
|
+
render_file_and_upload('cheftaskrun.ps1', options[:chef_task_run_ps1],
|
30
|
+
:options => options)
|
31
|
+
|
32
|
+
# create cheftask.xml that the scheduled task will be created with
|
33
|
+
render_file_and_upload('cheftask.xml', options[:chef_task_xml],
|
34
|
+
:options => options)
|
35
|
+
|
36
|
+
# create cheftask.ps1 that will immediately invoke the scheduled task and wait for completion
|
37
|
+
render_file_and_upload('cheftask.ps1', options[:chef_task_ps1],
|
38
|
+
:options => options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def run_chef_command()
|
42
|
+
return <<-EOH
|
43
|
+
$old = Get-ExecutionPolicy;
|
44
|
+
Set-ExecutionPolicy Unrestricted -force;
|
45
|
+
#{chef_task_ps1_path};
|
46
|
+
Set-ExecutionPolicy $old -force
|
47
|
+
EOH
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
def render_file_and_upload(script_name, dest_file, options)
|
53
|
+
# render the script file to a local temp file and then upload
|
54
|
+
script_local = Tempfile.new(script_name)
|
55
|
+
IO.write(script_local, VagrantWindows.load_script_template(script_name, options))
|
56
|
+
@windows_machine.winrmshell.upload(script_local, dest_file)
|
57
|
+
end
|
58
|
+
|
59
|
+
def create_chef_options
|
60
|
+
command_env = @config.binary_env ? "#{@config.binary_env} " : ''
|
61
|
+
return {
|
62
|
+
:user => @windows_machine.winrm_config.username,
|
63
|
+
:pass => @windows_machine.winrm_config.password,
|
64
|
+
:chef_arguments => create_chef_arguments(),
|
65
|
+
:chef_task_xml => provisioning_path('cheftask.xml'),
|
66
|
+
:chef_task_running => provisioning_path('cheftask.running'),
|
67
|
+
:chef_task_exitcode => provisioning_path('cheftask.exitcode'),
|
68
|
+
:chef_task_ps1 => chef_task_ps1_path(),
|
69
|
+
:chef_task_run_ps1 => provisioning_path('cheftaskrun.ps1'),
|
70
|
+
:chef_stdout_log => provisioning_path("chef-#{@client_type}.log"),
|
71
|
+
:chef_stderr_log => provisioning_path("chef-#{@client_type}.err.log"),
|
72
|
+
:chef_binary_path => win_friendly_path("#{command_env}#{chef_binary_path}")
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_chef_arguments()
|
77
|
+
command_args = @config.arguments ? @config.arguments : ''
|
78
|
+
chef_path = provisioning_path("#{@client_type}.rb")
|
79
|
+
chef_dna_path = provisioning_path('dna.json')
|
80
|
+
|
81
|
+
chef_arguments = "-c #{chef_path}"
|
82
|
+
chef_arguments << " -j #{chef_dna_path}"
|
83
|
+
chef_arguments << " #{command_args}"
|
84
|
+
chef_arguments.strip
|
85
|
+
end
|
86
|
+
|
87
|
+
def chef_task_ps1_path()
|
88
|
+
provisioning_path('cheftask.ps1')
|
89
|
+
end
|
90
|
+
|
91
|
+
# Returns the path to the Chef binary, taking into account the
|
92
|
+
# `binary_path` configuration option.
|
93
|
+
def chef_binary_path()
|
94
|
+
binary = "chef-#{@client_type}"
|
95
|
+
return binary if !@config.binary_path
|
96
|
+
return win_friendly_path(File.join(@config.binary_path, binary))
|
97
|
+
end
|
98
|
+
|
99
|
+
def provisioning_path(file_name)
|
100
|
+
win_friendly_path("#{@config.provisioning_path}/#{file_name}")
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -18,6 +18,13 @@ module VagrantWindows
|
|
18
18
|
@machine = machine
|
19
19
|
@logger = Log4r::Logger.new("vagrant_windows::windows_machine")
|
20
20
|
end
|
21
|
+
|
22
|
+
# Returns true if this Vagrant machine is a Windows guest, otherwise false.
|
23
|
+
#
|
24
|
+
# @return [Boolean]
|
25
|
+
def is_windows?()
|
26
|
+
WindowsMachine.is_windows?(@machine)
|
27
|
+
end
|
21
28
|
|
22
29
|
# Checks to see if the machine is using VMWare Fusion or Workstation.
|
23
30
|
#
|
@@ -55,6 +62,12 @@ module VagrantWindows
|
|
55
62
|
@machine.communicate.winrmshell
|
56
63
|
end
|
57
64
|
|
65
|
+
# Re-establishes our symbolic links if they were created between now and a reboot
|
66
|
+
# Fixes issue #119
|
67
|
+
def reinitialize_network_shares()
|
68
|
+
winrmshell.powershell('& net use a-non-existant-share')
|
69
|
+
end
|
70
|
+
|
58
71
|
# Reads the machine's MAC addresses keyed by interface index.
|
59
72
|
# {1=>"0800273FAC5A", 2=>"08002757E68A"}
|
60
73
|
#
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe VagrantWindows::Provisioners::ChefCommandBuilder, :unit => true do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@winrm_config = stub()
|
7
|
+
@winrm_config.stubs(:username).returns('vagrant')
|
8
|
+
@winrm_config.stubs(:password).returns('secret')
|
9
|
+
|
10
|
+
@windows_machine = stub()
|
11
|
+
@windows_machine.stubs(:winrm_config).returns(@winrm_config)
|
12
|
+
|
13
|
+
@chef_config = stub()
|
14
|
+
@chef_config.stubs(:provisioning_path).returns('/tmp/vagrant-chef-1')
|
15
|
+
@chef_config.stubs(:arguments).returns(nil)
|
16
|
+
@chef_config.stubs(:binary_env).returns(nil)
|
17
|
+
@chef_config.stubs(:binary_path).returns(nil)
|
18
|
+
|
19
|
+
@chef_cmd_builder = VagrantWindows::Provisioners::ChefCommandBuilder.new(
|
20
|
+
@windows_machine, @chef_config, :client)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'initialize' do
|
24
|
+
it 'should raise when chef type is not client or solo' do
|
25
|
+
expect { VagrantWindows::Provisioners::ChefCommandBuilder.new(@windows_machine, @chef_config, :zero) }.to raise_error
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'provisioning_path' do
|
30
|
+
it 'should be windows friendly' do
|
31
|
+
@chef_cmd_builder.provisioning_path('script.ps1').should eql 'c:\tmp\vagrant-chef-1\script.ps1'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'create_chef_arguments' do
|
36
|
+
it 'should include paths to client.rb and dna.json' do
|
37
|
+
expected = '-c c:\tmp\vagrant-chef-1\client.rb -j c:\tmp\vagrant-chef-1\dna.json'
|
38
|
+
@chef_cmd_builder.create_chef_arguments().should eql expected
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should include Chef arguments if specified' do
|
42
|
+
@chef_config.stubs(:arguments).returns('-l DEBUG')
|
43
|
+
expected = '-c c:\tmp\vagrant-chef-1\client.rb -j c:\tmp\vagrant-chef-1\dna.json -l DEBUG'
|
44
|
+
@chef_cmd_builder.create_chef_arguments().should eql expected
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'create_chef_options' do
|
49
|
+
it "should include winrm username and password" do
|
50
|
+
options = @chef_cmd_builder.create_chef_options()
|
51
|
+
options[:user].should eql 'vagrant'
|
52
|
+
options[:pass].should eql 'secret'
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should include paths to scripts' do
|
56
|
+
options = @chef_cmd_builder.create_chef_options()
|
57
|
+
options[:chef_task_xml].should eql 'c:\tmp\vagrant-chef-1\cheftask.xml'
|
58
|
+
options[:chef_task_ps1].should eql 'c:\tmp\vagrant-chef-1\cheftask.ps1'
|
59
|
+
options[:chef_task_run_ps1].should eql 'c:\tmp\vagrant-chef-1\cheftaskrun.ps1'
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should include paths to process flow files' do
|
63
|
+
options = @chef_cmd_builder.create_chef_options()
|
64
|
+
options[:chef_task_running].should eql 'c:\tmp\vagrant-chef-1\cheftask.running'
|
65
|
+
options[:chef_task_exitcode].should eql 'c:\tmp\vagrant-chef-1\cheftask.exitcode'
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should include paths to logs' do
|
69
|
+
options = @chef_cmd_builder.create_chef_options()
|
70
|
+
options[:chef_stdout_log].should eql 'c:\tmp\vagrant-chef-1\chef-client.log'
|
71
|
+
options[:chef_stderr_log].should eql 'c:\tmp\vagrant-chef-1\chef-client.err.log'
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should include path to chef binary' do
|
75
|
+
options = @chef_cmd_builder.create_chef_options()
|
76
|
+
options[:chef_binary_path].should eql 'chef-client'
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should include full path to chef binary when binary_path is set' do
|
80
|
+
@chef_config.stubs(:binary_path).returns('c:/opscode/chef/bin')
|
81
|
+
options = @chef_cmd_builder.create_chef_options()
|
82
|
+
options[:chef_binary_path].should eql 'c:\opscode\chef\bin\chef-client'
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
describe 'prepare_for_chef_run' do
|
88
|
+
it 'should upload cheftask scripts' do
|
89
|
+
winrmshell = double()
|
90
|
+
@windows_machine.stubs(:winrmshell).returns(winrmshell)
|
91
|
+
|
92
|
+
winrmshell.should_receive(:upload).with(anything(), 'c:\tmp\vagrant-chef-1\cheftaskrun.ps1')
|
93
|
+
winrmshell.should_receive(:upload).with(anything(), 'c:\tmp\vagrant-chef-1\cheftask.xml')
|
94
|
+
winrmshell.should_receive(:upload).with(anything(), 'c:\tmp\vagrant-chef-1\cheftask.ps1')
|
95
|
+
|
96
|
+
@chef_cmd_builder.prepare_for_chef_run()
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
@@ -37,6 +37,20 @@ describe VagrantWindows::WindowsMachine , :unit => true do
|
|
37
37
|
expect(windows_machine.is_virtualbox?()).to be_false
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
describe "is_parallels?" do
|
42
|
+
it "should be true for parallels" do
|
43
|
+
machine = stub(:provider_name => :parallels)
|
44
|
+
windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
45
|
+
expect(windows_machine.is_parallels?()).to be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be false for vmware_workstation" do
|
49
|
+
machine = stub(:provider_name => :vmware_workstation)
|
50
|
+
windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
51
|
+
expect(windows_machine.is_parallels?()).to be_false
|
52
|
+
end
|
53
|
+
end
|
40
54
|
|
41
55
|
describe "is_windows?" do
|
42
56
|
it "should return true when config vm guest is windows" do
|
@@ -45,6 +59,14 @@ describe VagrantWindows::WindowsMachine , :unit => true do
|
|
45
59
|
machine = stub(:config => config)
|
46
60
|
expect(VagrantWindows::WindowsMachine.is_windows?(machine)).to be_true
|
47
61
|
end
|
62
|
+
|
63
|
+
it "instance should return true when config vm guest is windows" do
|
64
|
+
vm = stub(:guest => :windows)
|
65
|
+
config = stub(:vm => vm)
|
66
|
+
machine = stub(:config => config)
|
67
|
+
windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
68
|
+
expect(windows_machine.is_windows?()).to be_true
|
69
|
+
end
|
48
70
|
|
49
71
|
it "should return false when config vm guest is not windows" do
|
50
72
|
vm = stub(:guest => :ubuntu)
|
@@ -52,6 +74,14 @@ describe VagrantWindows::WindowsMachine , :unit => true do
|
|
52
74
|
machine = stub(:config => config)
|
53
75
|
expect(VagrantWindows::WindowsMachine.is_windows?(machine)).to be_false
|
54
76
|
end
|
77
|
+
|
78
|
+
it "instance should return false when config vm guest is not windows" do
|
79
|
+
vm = stub(:guest => :fedora)
|
80
|
+
config = stub(:vm => vm)
|
81
|
+
machine = stub(:config => config)
|
82
|
+
windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
83
|
+
expect(windows_machine.is_windows?()).to be_false
|
84
|
+
end
|
55
85
|
end
|
56
86
|
|
57
87
|
describe "read_forwarded_ports" do
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-windows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.6.0.pre.1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Paul Morton
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: winrm
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/vagrant-windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet_server.rb
|
143
143
|
- lib/vagrant-windows/monkey_patches/plugins/provisioners/shell/provisioner.rb
|
144
144
|
- lib/vagrant-windows/plugin.rb
|
145
|
+
- lib/vagrant-windows/provisioners/chef_command_builder.rb
|
145
146
|
- lib/vagrant-windows/scripts/cheftask.ps1.erb
|
146
147
|
- lib/vagrant-windows/scripts/cheftask.xml.erb
|
147
148
|
- lib/vagrant-windows/scripts/cheftaskrun.ps1.erb
|
@@ -158,6 +159,7 @@ files:
|
|
158
159
|
- Rakefile
|
159
160
|
- README.md
|
160
161
|
- spec/spec_helper.rb
|
162
|
+
- spec/vagrant-windows/chef_command_builder_spec.rb
|
161
163
|
- spec/vagrant-windows/guestnetwork_spec.rb
|
162
164
|
- spec/vagrant-windows/helper_spec.rb
|
163
165
|
- spec/vagrant-windows/mount_shared_folder_spec.rb
|
@@ -185,16 +187,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
187
|
version: '0'
|
186
188
|
segments:
|
187
189
|
- 0
|
188
|
-
hash:
|
190
|
+
hash: 1012872433486920288
|
189
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
192
|
none: false
|
191
193
|
requirements:
|
192
|
-
- - ! '
|
194
|
+
- - ! '>'
|
193
195
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
195
|
-
segments:
|
196
|
-
- 0
|
197
|
-
hash: -4320786780650999420
|
196
|
+
version: 1.3.1
|
198
197
|
requirements: []
|
199
198
|
rubyforge_project:
|
200
199
|
rubygems_version: 1.8.23
|
@@ -204,6 +203,7 @@ summary: A small gem that adds windows guest support to vagrant, uses WinRM as t
|
|
204
203
|
Communication Channel
|
205
204
|
test_files:
|
206
205
|
- spec/spec_helper.rb
|
206
|
+
- spec/vagrant-windows/chef_command_builder_spec.rb
|
207
207
|
- spec/vagrant-windows/guestnetwork_spec.rb
|
208
208
|
- spec/vagrant-windows/helper_spec.rb
|
209
209
|
- spec/vagrant-windows/mount_shared_folder_spec.rb
|