vagrant-windows 1.6.0 → 1.7.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.md +7 -1
  4. data/Gemfile +5 -1
  5. data/README.md +3 -1
  6. data/lib/vagrant-windows/communication/command_filters/cat.rb +27 -0
  7. data/lib/vagrant-windows/communication/command_filters/chmod.rb +21 -0
  8. data/lib/vagrant-windows/communication/command_filters/chown.rb +21 -0
  9. data/lib/vagrant-windows/communication/command_filters/rm.rb +28 -0
  10. data/lib/vagrant-windows/communication/command_filters/test.rb +37 -0
  11. data/lib/vagrant-windows/communication/command_filters/uname.rb +36 -0
  12. data/lib/vagrant-windows/communication/command_filters/which.rb +26 -0
  13. data/lib/vagrant-windows/communication/linux_command_filter.rb +44 -0
  14. data/lib/vagrant-windows/communication/winrmcommunicator.rb +19 -12
  15. data/lib/vagrant-windows/communication/winrmfilemanager.rb +166 -0
  16. data/lib/vagrant-windows/communication/winrmshell.rb +4 -23
  17. data/lib/vagrant-windows/errors.rb +5 -1
  18. data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_client.rb +2 -5
  19. data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_solo.rb +2 -5
  20. data/lib/vagrant-windows/monkey_patches/plugins/provisioners/shell/provisioner.rb +13 -6
  21. data/lib/vagrant-windows/provisioners/chef_command_builder.rb +7 -53
  22. data/lib/vagrant-windows/scripts/elevated_shell.ps1.erb +95 -0
  23. data/lib/vagrant-windows/version.rb +1 -1
  24. data/locales/en.yml +7 -0
  25. data/spec/vagrant-windows/chef_command_builder_spec.rb +7 -53
  26. data/spec/vagrant-windows/guestnetwork_spec.rb +3 -3
  27. data/spec/vagrant-windows/linux_command_filter_spec.rb +73 -0
  28. data/spec/vagrant-windows/winrmcommunicator_spec.rb +55 -6
  29. data/spec/vagrant-windows/winrmshell_spec.rb +3 -3
  30. metadata +16 -8
  31. data/lib/vagrant-windows/scripts/cheftask.ps1.erb +0 -48
  32. data/lib/vagrant-windows/scripts/cheftask.xml.erb +0 -45
  33. data/lib/vagrant-windows/scripts/cheftaskrun.ps1.erb +0 -18
  34. data/lib/vagrant-windows/scripts/command_alias.ps1 +0 -36
@@ -22,58 +22,16 @@ module VagrantWindows
22
22
  @client_type = client_type
23
23
  end
24
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
25
  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}")
26
+ options = {
27
+ :command => "#{chef_binary_path} #{chef_arguments}",
28
+ :username => @windows_machine.winrm_config.username,
29
+ :password => @windows_machine.winrm_config.password
73
30
  }
31
+ return VagrantWindows.load_script_template('elevated_shell.ps1', :options => options)
74
32
  end
75
33
 
76
- def create_chef_arguments()
34
+ def chef_arguments()
77
35
  command_args = @config.arguments ? @config.arguments : ''
78
36
  chef_path = provisioning_path("#{@client_type}.rb")
79
37
  chef_dna_path = provisioning_path('dna.json')
@@ -84,10 +42,6 @@ module VagrantWindows
84
42
  chef_arguments.strip
85
43
  end
86
44
 
87
- def chef_task_ps1_path()
88
- provisioning_path('cheftask.ps1')
89
- end
90
-
91
45
  # Returns the path to the Chef binary, taking into account the
92
46
  # `binary_path` configuration option.
93
47
  def chef_binary_path()
@@ -102,4 +56,4 @@ module VagrantWindows
102
56
 
103
57
  end
104
58
  end
105
- end
59
+ end
@@ -0,0 +1,95 @@
1
+ $command = "<%= options[:command] %>"
2
+ $user = "<%= options[:username] %>"
3
+ $password = "<%= options[:password] %>"
4
+
5
+ $task_name = "WinRM_Elevated_Shell"
6
+ $out_file = "$env:SystemRoot\Temp\WinRM_Elevated_Shell.log"
7
+
8
+ if (Test-Path $out_file) {
9
+ del $out_file
10
+ }
11
+
12
+ $task_xml = @'
13
+ <?xml version="1.0" encoding="UTF-16"?>
14
+ <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
15
+ <Principals>
16
+ <Principal id="Author">
17
+ <UserId>{user}</UserId>
18
+ <LogonType>Password</LogonType>
19
+ <RunLevel>HighestAvailable</RunLevel>
20
+ </Principal>
21
+ </Principals>
22
+ <Settings>
23
+ <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
24
+ <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
25
+ <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
26
+ <AllowHardTerminate>true</AllowHardTerminate>
27
+ <StartWhenAvailable>false</StartWhenAvailable>
28
+ <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
29
+ <IdleSettings>
30
+ <StopOnIdleEnd>true</StopOnIdleEnd>
31
+ <RestartOnIdle>false</RestartOnIdle>
32
+ </IdleSettings>
33
+ <AllowStartOnDemand>true</AllowStartOnDemand>
34
+ <Enabled>true</Enabled>
35
+ <Hidden>false</Hidden>
36
+ <RunOnlyIfIdle>false</RunOnlyIfIdle>
37
+ <WakeToRun>false</WakeToRun>
38
+ <ExecutionTimeLimit>PT2H</ExecutionTimeLimit>
39
+ <Priority>4</Priority>
40
+ </Settings>
41
+ <Actions Context="Author">
42
+ <Exec>
43
+ <Command>cmd</Command>
44
+ <Arguments>{arguments}</Arguments>
45
+ </Exec>
46
+ </Actions>
47
+ </Task>
48
+ '@
49
+
50
+ $bytes = [System.Text.Encoding]::Unicode.GetBytes($command)
51
+ $encoded_command = [Convert]::ToBase64String($bytes)
52
+ $arguments = "/c powershell.exe -EncodedCommand $encoded_command &gt; $out_file 2&gt;&amp;1"
53
+
54
+ $task_xml = $task_xml.Replace("{arguments}", $arguments)
55
+ $task_xml = $task_xml.Replace("{user}", $user)
56
+
57
+ $schedule = New-Object -ComObject "Schedule.Service"
58
+ $schedule.Connect()
59
+ $task = $schedule.NewTask($null)
60
+ $task.XmlText = $task_xml
61
+ $folder = $schedule.GetFolder("\")
62
+ $folder.RegisterTaskDefinition($task_name, $task, 6, $user, $password, 1, $null) | Out-Null
63
+
64
+ $registered_task = $folder.GetTask("\$task_name")
65
+ $registered_task.Run($null) | Out-Null
66
+
67
+ $timeout = 10
68
+ $sec = 0
69
+ while ( (!($registered_task.state -eq 4)) -and ($sec -lt $timeout) ) {
70
+ Start-Sleep -s 1
71
+ $sec++
72
+ }
73
+
74
+ # Read the entire file, but only write out new lines we haven't seen before
75
+ $numLinesRead = 0
76
+ do {
77
+ Start-Sleep -m 100
78
+
79
+ if (Test-Path $out_file) {
80
+ $text = (get-content $out_file)
81
+ $numLines = ($text | Measure-Object -line).lines
82
+ $numLinesToRead = $numLines - $numLinesRead
83
+
84
+ if ($numLinesToRead -gt 0) {
85
+ $text | select -first $numLinesToRead -skip $numLinesRead | ForEach {
86
+ Write-Host "$_"
87
+ }
88
+ $numLinesRead += $numLinesToRead
89
+ }
90
+ }
91
+ } while (!($registered_task.state -eq 3))
92
+
93
+ $exit_code = $registered_task.LastTaskResult
94
+ [System.Runtime.Interopservices.Marshal]::ReleaseComObject($schedule) | Out-Null
95
+ exit $exit_code
@@ -1,3 +1,3 @@
1
1
  module VagrantWindows
2
- VERSION = "1.6.0"
2
+ VERSION = "1.7.0.pre.1"
3
3
  end
data/locales/en.yml CHANGED
@@ -24,3 +24,10 @@ en:
24
24
  Password: %{password}
25
25
  Endpoint: %{endpoint}
26
26
  Message: %{message}
27
+
28
+ winrm_file_transfer_error: |-
29
+ Failed to transfer a file between the host and guest
30
+
31
+ From: %{from}
32
+ To: %{to}
33
+ Message: %{message}
@@ -32,70 +32,24 @@ describe VagrantWindows::Provisioners::ChefCommandBuilder, :unit => true do
32
32
  end
33
33
  end
34
34
 
35
- describe 'create_chef_arguments' do
35
+ describe 'chef_arguments' do
36
36
  it 'should include paths to client.rb and dna.json' do
37
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
38
+ @chef_cmd_builder.chef_arguments().should eql expected
39
39
  end
40
40
 
41
41
  it 'should include Chef arguments if specified' do
42
42
  @chef_config.stubs(:arguments).returns('-l DEBUG')
43
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
44
+ @chef_cmd_builder.chef_arguments().should eql expected
45
45
  end
46
46
  end
47
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'
48
+ describe 'run chef command' do
49
+ it "should include chef-client cmd line" do
50
+ expect(@chef_cmd_builder.run_chef_command()).to include(
51
+ 'chef-client -c c:\\tmp\\vagrant-chef-1\\client.rb -j c:\\tmp\\vagrant-chef-1\\dna.json')
53
52
  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
53
  end
100
54
 
101
55
  end
@@ -3,9 +3,9 @@ require 'spec_helper'
3
3
  describe VagrantWindows::Communication::GuestNetwork , :integration => true do
4
4
 
5
5
  before(:all) do
6
- # This test requires you already have a running Windows Server 2008 R2 Vagrant VM
7
- # Not ideal, but you have to start somewhere
8
- @shell = VagrantWindows::Communication::WinRMShell.new("127.0.0.1", "vagrant", "vagrant")
6
+ port = (ENV['WINRM_PORT'] || 5985).to_i
7
+ @shell = VagrantWindows::Communication::WinRMShell.new(
8
+ "127.0.0.1", "vagrant", "vagrant", { port: port })
9
9
  @guestnetwork = VagrantWindows::Communication::GuestNetwork.new(@shell)
10
10
  end
11
11
 
@@ -0,0 +1,73 @@
1
+ require 'spec_helper'
2
+ require 'vagrant-windows/communication/linux_command_filter'
3
+
4
+ describe VagrantWindows::Communication::LinuxCommandFilter, :unit => true do
5
+
6
+ before(:each) do
7
+ @cmd_filter = VagrantWindows::Communication::LinuxCommandFilter.new()
8
+ end
9
+
10
+ describe 'command filters' do
11
+ it 'should initialize all command filters in command filters directory' do
12
+ expect(@cmd_filter.command_filters()).not_to be_empty
13
+ end
14
+ end
15
+
16
+ describe 'filter' do
17
+ it 'should filter out uname commands' do
18
+ expect(@cmd_filter.filter('uname -s stuff')).to eq('')
19
+ end
20
+
21
+ it 'should filter out which commands' do
22
+ expect(@cmd_filter.filter('which ruby')).to include(
23
+ '[Array](Get-Command ruby -errorAction SilentlyContinue)')
24
+ end
25
+
26
+ it 'should filter out test -d commands' do
27
+ expect(@cmd_filter.filter('test -d /tmp/dir')).to eq(
28
+ "if ((Test-Path '/tmp/dir') -and (get-item '/tmp/dir').PSIsContainer) { exit 0 } exit 1")
29
+ end
30
+
31
+ it 'should filter out test -f commands' do
32
+ expect(@cmd_filter.filter('test -f /tmp/file.txt')).to eq(
33
+ "if ((Test-Path '/tmp/file.txt') -and (!(get-item '/tmp/file.txt').PSIsContainer)) { exit 0 } exit 1")
34
+ end
35
+
36
+ it 'should filter out test -x commands' do
37
+ expect(@cmd_filter.filter('test -x /tmp/file.txt')).to eq(
38
+ "if ((Test-Path '/tmp/file.txt') -and (!(get-item '/tmp/file.txt').PSIsContainer)) { exit 0 } exit 1")
39
+ end
40
+
41
+ it 'should filter out other test commands' do
42
+ expect(@cmd_filter.filter('test -L /tmp/file.txt')).to eq(
43
+ "if (Test-Path '/tmp/file.txt') { exit 0 } exit 1")
44
+ end
45
+
46
+ it 'should filter out rm -Rf commands' do
47
+ expect(@cmd_filter.filter('rm -Rf /some/dir')).to eq(
48
+ "rm '/some/dir' -recurse -force")
49
+ end
50
+
51
+ it 'should filter out rm commands' do
52
+ expect(@cmd_filter.filter('rm /some/dir')).to eq(
53
+ "rm '/some/dir' -force")
54
+ end
55
+
56
+ it 'should filter out chown commands' do
57
+ expect(@cmd_filter.filter("chown -R root '/tmp/dir'")).to eq('')
58
+ end
59
+
60
+ it 'should filter out chmod commands' do
61
+ expect(@cmd_filter.filter("chmod 0600 ~/.ssh/authorized_keys")).to eq('')
62
+ end
63
+
64
+ it 'should filter out certain cat commands' do
65
+ expect(@cmd_filter.filter("cat /etc/release | grep -i OmniOS")).to eq('')
66
+ end
67
+
68
+ it 'should not filter out other cat commands' do
69
+ expect(@cmd_filter.filter("cat /tmp/somefile")).to eq('cat /tmp/somefile')
70
+ end
71
+ end
72
+
73
+ end
@@ -3,10 +3,10 @@ require 'spec_helper'
3
3
  describe VagrantWindows::Communication::WinRMCommunicator, :integration => true do
4
4
 
5
5
  before(:all) do
6
- # This test requires you already have a running Windows Server 2008 R2 Vagrant VM
7
- # Not ideal, but you have to start somewhere
8
6
  @communicator = VagrantWindows::Communication::WinRMCommunicator.new({})
9
- @communicator.winrmshell = VagrantWindows::Communication::WinRMShell.new("127.0.0.1", "vagrant", "vagrant")
7
+ port = (ENV['WINRM_PORT'] || 5985).to_i
8
+ @communicator.winrmshell = VagrantWindows::Communication::WinRMShell.new(
9
+ "127.0.0.1", "vagrant", "vagrant", { port: port })
10
10
  end
11
11
 
12
12
  describe "execute" do
@@ -28,20 +28,69 @@ describe VagrantWindows::Communication::WinRMCommunicator, :integration => true
28
28
  it "should upload the file and overwrite it if it exists" do
29
29
  test_file = Tempfile.new("uploadtest")
30
30
  IO.write(test_file, "hello world")
31
- @communicator.upload(test_file, "c:\\vagrantuploadtest.txt")
31
+ @communicator.upload(test_file, "c:/tmp/winrm-test/vagrantuploadtest.txt")
32
32
 
33
33
  # ensure we can overwrite
34
34
  IO.write(test_file, "goodbye cruel world")
35
- @communicator.upload(test_file, "c:\\vagrantuploadtest.txt")
35
+ @communicator.upload(test_file, "c:/tmp/winrm-test/vagrantuploadtest.txt")
36
36
 
37
37
  # get the uploaded file's contents to ensure it uploaded properly
38
38
  uploaded_file_content = ''
39
- @communicator.execute("cat c:\\vagrantuploadtest.txt", {}) do |type, line|
39
+ @communicator.execute("cat c:/tmp/winrm-test/vagrantuploadtest.txt", {}) do |type, line|
40
40
  uploaded_file_content = uploaded_file_content + line
41
41
  end
42
42
 
43
43
  expect(uploaded_file_content.chomp).to eq("goodbye cruel world")
44
44
  end
45
+
46
+ it "should recursively upload directories" do
47
+ # create a some test data
48
+ host_src_dir = Dir.mktmpdir("winrm_comm")
49
+
50
+ begin
51
+ IO.write(File.join(host_src_dir, 'root.txt'), "root\n")
52
+
53
+ subdir2 = File.join(host_src_dir, '/subdir1/subdir2')
54
+ FileUtils.mkdir_p(subdir2)
55
+
56
+ IO.write(File.join(subdir2, 'leaf1.txt'), "leaf1\n")
57
+ IO.write(File.join(subdir2, 'leaf2.txt'), "leaf2\n")
58
+
59
+ @communicator.upload(host_src_dir, '/tmp/winrm-test-upload') #c:\tmp\winrm-test-upload
60
+
61
+ @communicator.execute <<-EOH
62
+ function AssertExists($p) {
63
+ if (!(Test-Path $p)) {
64
+ exit 1
65
+ }
66
+ }
67
+
68
+ AssertExists 'c:/tmp/winrm-test-upload/root.txt'
69
+ AssertExists 'c:/tmp/winrm-test-upload/subdir1/subdir2/leaf2.txt'
70
+ AssertExists 'c:/tmp/winrm-test-upload/subdir1/subdir2/leaf1.txt'
71
+ EOH
72
+ ensure
73
+ FileUtils.remove_entry_secure host_src_dir
74
+ end
75
+ end
76
+ end
77
+
78
+ describe 'test' do
79
+ it "should return true if directory exists" do
80
+ @communicator.execute('mkdir -p /tmp/winrm-test/1')
81
+ expect(@communicator.test('test -d /tmp/winrm-test/1')).to be_true
82
+ end
83
+
84
+ it "should return false if directory does not exist" do
85
+ expect(@communicator.test('test -d /tmp/winrm-test/doesnotexit')).to be_false
86
+ end
87
+
88
+ it "should differentiate between directories and files" do
89
+ @communicator.execute('mkdir -p /tmp/winrm-test/2')
90
+ @communicator.execute('Add-Content /tmp/winrm-test/2/file.txt "The content"')
91
+ expect(@communicator.test('test -d /tmp/winrm-test/2/file.txt')).to be_false
92
+ expect(@communicator.test('test -f /tmp/winrm-test/2/file.txt')).to be_true
93
+ end
45
94
  end
46
95
 
47
96
  end
@@ -3,9 +3,9 @@ require 'spec_helper'
3
3
  describe VagrantWindows::Communication::WinRMShell, :integration => true do
4
4
 
5
5
  before(:all) do
6
- # This test requires you already have a running Windows Server 2008 R2 Vagrant VM
7
- # Not ideal, but you have to start somewhere
8
- @shell = VagrantWindows::Communication::WinRMShell.new("127.0.0.1", "vagrant", "vagrant")
6
+ port = (ENV['WINRM_PORT'] || 5985).to_i
7
+ @shell = VagrantWindows::Communication::WinRMShell.new(
8
+ "127.0.0.1", "vagrant", "vagrant", { port: port })
9
9
  end
10
10
 
11
11
  describe "powershell" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-windows
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Morton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-20 00:00:00.000000000 Z
12
+ date: 2014-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: winrm
@@ -105,8 +105,17 @@ extra_rdoc_files: []
105
105
  files:
106
106
  - CHANGELOG.md
107
107
  - Gemfile
108
+ - lib/vagrant-windows/communication/command_filters/cat.rb
109
+ - lib/vagrant-windows/communication/command_filters/chmod.rb
110
+ - lib/vagrant-windows/communication/command_filters/chown.rb
111
+ - lib/vagrant-windows/communication/command_filters/rm.rb
112
+ - lib/vagrant-windows/communication/command_filters/test.rb
113
+ - lib/vagrant-windows/communication/command_filters/uname.rb
114
+ - lib/vagrant-windows/communication/command_filters/which.rb
108
115
  - lib/vagrant-windows/communication/guestnetwork.rb
116
+ - lib/vagrant-windows/communication/linux_command_filter.rb
109
117
  - lib/vagrant-windows/communication/winrmcommunicator.rb
118
+ - lib/vagrant-windows/communication/winrmfilemanager.rb
110
119
  - lib/vagrant-windows/communication/winrmfinder.rb
111
120
  - lib/vagrant-windows/communication/winrmshell.rb
112
121
  - lib/vagrant-windows/communication/winrmshell_factory.rb
@@ -130,10 +139,7 @@ files:
130
139
  - lib/vagrant-windows/monkey_patches/plugins/provisioners/shell/provisioner.rb
131
140
  - lib/vagrant-windows/plugin.rb
132
141
  - lib/vagrant-windows/provisioners/chef_command_builder.rb
133
- - lib/vagrant-windows/scripts/cheftask.ps1.erb
134
- - lib/vagrant-windows/scripts/cheftask.xml.erb
135
- - lib/vagrant-windows/scripts/cheftaskrun.ps1.erb
136
- - lib/vagrant-windows/scripts/command_alias.ps1
142
+ - lib/vagrant-windows/scripts/elevated_shell.ps1.erb
137
143
  - lib/vagrant-windows/scripts/mount_volume.ps1.erb
138
144
  - lib/vagrant-windows/scripts/reboot_detect.ps1
139
145
  - lib/vagrant-windows/scripts/set_work_network.ps1
@@ -149,6 +155,7 @@ files:
149
155
  - spec/vagrant-windows/chef_command_builder_spec.rb
150
156
  - spec/vagrant-windows/guestnetwork_spec.rb
151
157
  - spec/vagrant-windows/helper_spec.rb
158
+ - spec/vagrant-windows/linux_command_filter_spec.rb
152
159
  - spec/vagrant-windows/mount_shared_folder_spec.rb
153
160
  - spec/vagrant-windows/windows_config_spec.rb
154
161
  - spec/vagrant-windows/windows_machine_spec.rb
@@ -174,9 +181,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
181
  version: '0'
175
182
  required_rubygems_version: !ruby/object:Gem::Requirement
176
183
  requirements:
177
- - - '>='
184
+ - - '>'
178
185
  - !ruby/object:Gem::Version
179
- version: '0'
186
+ version: 1.3.1
180
187
  requirements: []
181
188
  rubyforge_project:
182
189
  rubygems_version: 2.0.14
@@ -189,6 +196,7 @@ test_files:
189
196
  - spec/vagrant-windows/chef_command_builder_spec.rb
190
197
  - spec/vagrant-windows/guestnetwork_spec.rb
191
198
  - spec/vagrant-windows/helper_spec.rb
199
+ - spec/vagrant-windows/linux_command_filter_spec.rb
192
200
  - spec/vagrant-windows/mount_shared_folder_spec.rb
193
201
  - spec/vagrant-windows/windows_config_spec.rb
194
202
  - spec/vagrant-windows/windows_machine_spec.rb
@@ -1,48 +0,0 @@
1
- # kill the task so we can recreate it
2
- schtasks /delete /tn "chef-solo" /f 2>&1 | out-null
3
-
4
- # Ensure the chef task running file doesn't exist from a previous failure
5
- if (Test-Path "<%= options[:chef_task_running] %>") {
6
- del "<%= options[:chef_task_running] %>"
7
- }
8
-
9
- # schedule the task to run once in the far distant future
10
- schtasks /create /tn 'chef-solo' /xml '<%= options[:chef_task_xml] %>' /ru '<%= options[:user] %>' /rp '<%= options[:pass] %>' | Out-Null
11
-
12
- # start the scheduled task right now
13
- schtasks /run /tn "chef-solo" | Out-Null
14
-
15
- # wait for run_chef.ps1 to start or timeout after 1 minute
16
- $timeoutSeconds = 60
17
- $elapsedSeconds = 0
18
- while ( (!(Test-Path "<%= options[:chef_task_running] %>")) -and ($elapsedSeconds -lt $timeoutSeconds) ) {
19
- Start-Sleep -s 1
20
- $elapsedSeconds++
21
- }
22
-
23
- if ($elapsedSeconds -ge $timeoutSeconds) {
24
- Write-Error "Timed out waiting for chef scheduled task to start"
25
- exit -2
26
- }
27
-
28
- # read the entire file, but only write out new lines we haven't seen before
29
- $numLinesRead = 0
30
- $success = $TRUE
31
- while (Test-Path "<%= options[:chef_task_running] %>") {
32
- Start-Sleep -m 100
33
-
34
- if (Test-Path "<%= options[:chef_stdout_log] %>") {
35
- $text = (get-content "<%= options[:chef_stdout_log] %>")
36
- $numLines = ($text | Measure-Object -line).lines
37
- $numLinesToRead = $numLines - $numLinesRead
38
-
39
- if ($numLinesToRead -gt 0) {
40
- $text | select -first $numLinesToRead -skip $numLinesRead | ForEach {
41
- Write-Host "$_"
42
- }
43
- $numLinesRead += $numLinesToRead
44
- }
45
- }
46
- }
47
-
48
- exit Get-Content "<%= options[:chef_task_exitcode] %>"
@@ -1,45 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-16"?>
2
- <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
3
- <RegistrationInfo>
4
- <Date>2013-06-21T22:41:43</Date>
5
- <Author>Administrator</Author>
6
- </RegistrationInfo>
7
- <Triggers>
8
- <TimeTrigger>
9
- <StartBoundary>2045-01-01T12:00:00</StartBoundary>
10
- <Enabled>true</Enabled>
11
- </TimeTrigger>
12
- </Triggers>
13
- <Principals>
14
- <Principal id="Author">
15
- <UserId>vagrant</UserId>
16
- <LogonType>Password</LogonType>
17
- <RunLevel>HighestAvailable</RunLevel>
18
- </Principal>
19
- </Principals>
20
- <Settings>
21
- <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
22
- <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
23
- <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
24
- <AllowHardTerminate>true</AllowHardTerminate>
25
- <StartWhenAvailable>false</StartWhenAvailable>
26
- <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
27
- <IdleSettings>
28
- <StopOnIdleEnd>true</StopOnIdleEnd>
29
- <RestartOnIdle>false</RestartOnIdle>
30
- </IdleSettings>
31
- <AllowStartOnDemand>true</AllowStartOnDemand>
32
- <Enabled>true</Enabled>
33
- <Hidden>false</Hidden>
34
- <RunOnlyIfIdle>false</RunOnlyIfIdle>
35
- <WakeToRun>false</WakeToRun>
36
- <ExecutionTimeLimit>PT2H</ExecutionTimeLimit>
37
- <Priority>4</Priority>
38
- </Settings>
39
- <Actions Context="Author">
40
- <Exec>
41
- <Command>powershell</Command>
42
- <Arguments>-file <%= options[:chef_task_run_ps1] %></Arguments>
43
- </Exec>
44
- </Actions>
45
- </Task>
@@ -1,18 +0,0 @@
1
- $exitCode = -1
2
- Set-ExecutionPolicy Unrestricted -force;
3
-
4
- Try
5
- {
6
- "running" | Out-File "<%= options[:chef_task_running] %>"
7
- $process = (Start-Process "<%= options[:chef_binary_path] %>" -ArgumentList "<%= options[:chef_arguments] %>" -NoNewWindow -PassThru -Wait -RedirectStandardOutput "<%= options[:chef_stdout_log] %>" -RedirectStandardError "<%= options[:chef_stderr_log] %>")
8
- $exitCode = $process.ExitCode
9
- }
10
- Finally
11
- {
12
- $exitCode | Out-File "<%= options[:chef_task_exitcode] %>"
13
- if (Test-Path "<%= options[:chef_task_running] %>") {
14
- del "<%= options[:chef_task_running] %>"
15
- }
16
- }
17
-
18
- exit $exitCode