vagrant-windows 1.0.3 → 1.2.0

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.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +1 -1
  5. data/README.md +77 -20
  6. data/Rakefile +14 -4
  7. data/lib/vagrant-windows/communication/guestnetwork.rb +133 -0
  8. data/lib/vagrant-windows/communication/winrmcommunicator.rb +56 -151
  9. data/lib/vagrant-windows/communication/winrmfinder.rb +45 -0
  10. data/lib/vagrant-windows/communication/winrmshell.rb +141 -0
  11. data/lib/vagrant-windows/config/windows.rb +4 -0
  12. data/lib/vagrant-windows/config/winrm.rb +1 -1
  13. data/lib/vagrant-windows/guest/cap/change_host_name.rb +14 -0
  14. data/lib/vagrant-windows/guest/cap/configure_networks.rb +69 -0
  15. data/lib/vagrant-windows/guest/cap/halt.rb +22 -0
  16. data/lib/vagrant-windows/guest/cap/mount_virtualbox_shared_folder.rb +17 -0
  17. data/lib/vagrant-windows/guest/cap/mount_vmware_shared_folder.rb +15 -0
  18. data/lib/vagrant-windows/guest/windows.rb +46 -77
  19. data/lib/vagrant-windows/helper.rb +6 -0
  20. data/lib/vagrant-windows/monkey_patches/{machine.rb → lib/vagrant/machine.rb} +7 -0
  21. data/lib/vagrant-windows/monkey_patches/plugins/providers/virtualbox/action/share_folders.rb +44 -0
  22. data/lib/vagrant-windows/monkey_patches/{vbox_42_driver.rb → plugins/providers/virtualbox/driver/version_4_2.rb} +0 -0
  23. data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_client.rb +1 -0
  24. data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_solo.rb +106 -0
  25. data/lib/vagrant-windows/monkey_patches/{puppet.rb → plugins/provisioners/puppet/provisioner/puppet.rb} +5 -4
  26. data/lib/vagrant-windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet_server.rb +1 -0
  27. data/lib/vagrant-windows/monkey_patches/{provisioner.rb → plugins/provisioners/shell/provisioner.rb} +4 -4
  28. data/lib/vagrant-windows/plugin.rb +54 -27
  29. data/lib/vagrant-windows/scripts/cheftask.ps1.erb +47 -0
  30. data/lib/vagrant-windows/scripts/cheftask.xml.erb +45 -0
  31. data/lib/vagrant-windows/scripts/cheftaskrun.ps1.erb +16 -0
  32. data/lib/vagrant-windows/scripts/command_alias.ps1 +4 -0
  33. data/lib/vagrant-windows/scripts/{mount_volume.ps1.erb → mount_volume.virtualbox.ps1.erb} +1 -1
  34. data/lib/vagrant-windows/scripts/mount_volume.vmware.ps1.erb +49 -0
  35. data/lib/vagrant-windows/scripts/set_work_network.ps1 +6 -0
  36. data/lib/vagrant-windows/scripts/winrs_v3_get_adapters.ps1 +11 -0
  37. data/lib/vagrant-windows/version.rb +1 -1
  38. data/spec/spec_helper.rb +14 -0
  39. data/spec/vagrant-windows/config_spec.rb +3 -4
  40. data/spec/vagrant-windows/guestnetwork_spec.rb +47 -0
  41. data/spec/vagrant-windows/helper_spec.rb +14 -3
  42. data/spec/vagrant-windows/winrmcommunicator_spec.rb +26 -0
  43. data/vagrant-windows.gemspec +33 -2
  44. metadata +100 -55
  45. data/lib/vagrant-windows/monkey_patches/chef_solo.rb +0 -61
  46. data/lib/vagrant-windows/scripts/ps_runas.ps1.erb +0 -56
@@ -1,61 +0,0 @@
1
- require "#{Vagrant::source_root}/plugins/provisioners/chef/provisioner/chef_solo"
2
-
3
- module VagrantPlugins
4
- module Chef
5
- module Provisioner
6
- class ChefSolo < Base
7
-
8
- run_chef_solo_on_linux = instance_method(:run_chef_solo)
9
-
10
- # This patch is needed until Vagrant supports chef on Windows guests
11
- define_method(:run_chef_solo) do
12
- is_windows ? run_chef_solo_on_windows() : run_chef_solo_on_linux.bind(self).()
13
- end
14
-
15
- def run_chef_solo_on_windows
16
- command_env = @config.binary_env ? "#{@config.binary_env} " : ""
17
- command_args = @config.arguments ? " #{@config.arguments}" : ""
18
- command_solo = "#{command_env}#{chef_binary_path("chef-solo")} "
19
- command_solo << "-c #{@config.provisioning_path}/solo.rb "
20
- command_solo << "-j #{@config.provisioning_path}/dna.json "
21
- command_solo << "#{command_args}"
22
-
23
- command = VagrantWindows.load_script_template("ps_runas.ps1",
24
- :options => {
25
- :user => machine.config.winrm.username,
26
- :password => @machine.config.winrm.password,
27
- :cmd => "powershell.exe",
28
- :arguments => "-Command #{command_solo}"})
29
-
30
- @config.attempts.times do |attempt|
31
- if attempt == 0
32
- @machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
33
- else
34
- @machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_solo_again")
35
- end
36
-
37
- exit_status = @machine.communicate.sudo(command, :error_check => false) do |type, data|
38
- # Output the data with the proper color based on the stream.
39
- color = type == :stdout ? :green : :red
40
-
41
- # Note: Be sure to chomp the data to avoid the newlines that the
42
- # Chef outputs.
43
- @machine.env.ui.info(data.chomp, :color => color, :prefix => false)
44
- end
45
-
46
- # There is no need to run Chef again if it converges
47
- return if exit_status == 0
48
- end
49
-
50
- # If we reached this point then Chef never converged! Error.
51
- raise ChefError, :no_convergence
52
- end
53
-
54
- def is_windows
55
- @machine.config.vm.guest.eql? :windows
56
- end
57
-
58
- end # ChefSolo class
59
- end
60
- end
61
- end
@@ -1,56 +0,0 @@
1
- function ps-runas ([String] $user, [String] $password, [String] $cmd, [String] $arguments)
2
- {
3
- $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
4
- $process = New-Object System.Diagnostics.Process
5
- $setup = $process.StartInfo
6
- $setup.FileName = $cmd
7
- $setup.Arguments = $arguments
8
- $setup.UserName = $user
9
- $setup.Password = $secpasswd
10
- $setup.Verb = "runas"
11
- $setup.UseShellExecute = $false
12
- $setup.RedirectStandardError = $true
13
- $setup.RedirectStandardOutput = $true
14
- $setup.RedirectStandardInput = $false
15
-
16
- $errEvent = Register-ObjectEvent -InputObj $process `
17
- -Event "ErrorDataReceived" `
18
- -Action `
19
- {
20
- param([System.Object] $sender, [System.Diagnostics.DataReceivedEventArgs] $e)
21
- if ($e.Data)
22
- {
23
- Write-Host $e.Data
24
- }
25
- else
26
- {
27
- New-Event -SourceIdentifier "LastMsgReceived"
28
- }
29
- }
30
-
31
- $outEvent = Register-ObjectEvent -InputObj $process `
32
- -Event "OutputDataReceived" `
33
- -Action `
34
- {
35
- param([System.Object] $sender, [System.Diagnostics.DataReceivedEventArgs] $e)
36
- Write-Host $e.Data
37
- }
38
-
39
- $exitCode = -1
40
- if ($process.Start())
41
- {
42
- $process.BeginOutputReadLine()
43
- $process.BeginErrorReadLine()
44
-
45
- $process.WaitForExit()
46
- $exitCode = [int]$process.ExitCode
47
- Wait-Event -SourceIdentifier "LastMsgReceived" -Timeout 60 | Out-Null
48
-
49
- $process.CancelOutputRead()
50
- $process.CancelErrorRead()
51
- $process.Close()
52
- }
53
- return $exitCode
54
- }
55
-
56
- exit ps-runas "<%= options[:user] %>" "<%= options[:password] %>" "<%= options[:cmd] %>" "<%= options[:arguments] %>"