Open chriskilding opened 10 years ago
I'm seeing the same thing here:
/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/communicators/winrm/communicator.rb:76:in `execute': undefined method `sh' for #<VagrantPlugins::CommunicatorWinRM::WinRMShell:0x0000010360c030> (NoMethodError)
from /Users/nc014943/.vagrant.d/gems/gems/vagrant-omnibus-1.4.1/lib/vagrant-omnibus/action/install_chef.rb:144:in `installed_version'
from /Users/nc014943/.vagrant.d/gems/gems/vagrant-omnibus-1.4.1/lib/vagrant-omnibus/action/install_chef.rb:47:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builtin/provision.rb:80:in `call```
It should be set to ':cmd' but the windows guest detection is broken
def windows_guest?
@machine.config.vm.guest.eql?(:windows)
end
@machine.config.vm.guest
is nil so it's incorrectly detecting a non-windows guest.
I have a machine running on a host windows and had no problems. My VagrantFile is like this:
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ferventcoder/win2008r2-x64-nocm"
config.vm.communicator = "winrm"
config.vm.guest = :windows
...
end
Vagrant 1.6.3 vagrant-omnibus (1.4.1) Host Windows 7 Professional x64
I would consider config.vm.guest = :windows
a (good) workaround. Vagrant 1.6+ uses the communicator type to figure out if it should use WinRM or SSH, and thus shell type. Vagrant doesn't require you to set the guest type to windows like the old vagrant-windows plugin.
It would be good to have the check be consistent between any plugins and Vagrant core.
+1 just hit this as well. Adding below fixed the error.
config.vm.guest = :windows
With that said, I would wager a guess that guest :windows is an artifact left behind to avoid breaking people after vagrant started officially supporting windows (I think guest :windows essentially translates into communicator = 'winrm'. It may go away at some point.
@vinyar Guest and Communicator seem similar, but are very different. For example, you can set the guest type to 'windows' and the communicator to 'ssh' assuming you've installed and configured an SSH server on your Windows guest.
Thanks @sneal this also immediately fixed the omnibus issue for me for a Windows on Softlayer VM.
This issue has been migrated from (#4249)[https://github.com/mitchellh/vagrant/issues/4249] in Vagrant core, after @sneal found it to be a bug with this plugin instead.
I got the following error when trying to provision a Windows Server 2008 R2 box with Chef Solo and vagrant-omnibus. A cursory look suggests something thought it was in *nix land and called 'sh' when it shouldn't have done.
The box I'm using is https://vagrantcloud.com/ferventcoder/win2008r2-x64-nocm. Running on Vagrant 1.6.3 / OSX 10.9 / latest Chef development kit with integrated Berkshelf.