Cimpress-MCP / vagrant-orchestrate

Cross platform deployment orchestration to existing managed servers using vagrant provisioners
Other
19 stars 13 forks source link

Add ability to push from Mac/Linux to windows. #3

Open chrisbaldauf opened 9 years ago

chrisbaldauf commented 9 years ago

Currently if you initialize a Vagrantfile that uses the WinRM communicator and then attempt to do a push from a Mac or Linux box, you receive the error message below. Now that we (roughly) know how to make this work for domain accounts over SSL instead of SSPI Negotiate, change the transport and conditionally require winrm-s.

$ vagrant orchestrate init --shell --shell-inline "echo Hello" --servers mywindowsserver1.mydomain.com --winrm --winrm-username USERNAME --winrm-password PASSWORD
$ vagrant orchestrate push

/Users/cbaldauf/.vagrant.d/gems/gems/winrm-s-0.1.0/lib/winrm-s.rb:29:in `<top (required)>': ERROR: winrm-s extensions to the winrm gem for the negotiate protocol are only supported on Windows. Require 'winrm' and not 'winrm-s' on non-Windows platforms. (RuntimeError)
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-winrm-s-0.0.1/lib/vagrant-winrm-s/shell.rb:7:in `require'
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-winrm-s-0.0.1/lib/vagrant-winrm-s/shell.rb:7:in `block in <top (required)>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/silence_warnings.rb:8:in `silence!'
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-winrm-s-0.0.1/lib/vagrant-winrm-s/shell.rb:6:in `<top (required)>'
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-winrm-s-0.0.1/lib/vagrant-winrm-s/communicator.rb:5:in `require_relative'
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-winrm-s-0.0.1/lib/vagrant-winrm-s/communicator.rb:5:in `<top (required)>'
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-winrm-s-0.0.1/lib/vagrant-winrm-s/plugin.rb:19:in `require'
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-winrm-s-0.0.1/lib/vagrant-winrm-s/plugin.rb:19:in `block in <class:WinrmSPlugin>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/registry.rb:27:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/registry.rb:27:in `get'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:235:in `communicate'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:136:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/vagrantfile.rb:75:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/vagrantfile.rb:75:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:614:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:168:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:201:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:200:in `map'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:200:in `with_target_vms'
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-orchestrate-0.0.7/lib/vagrant-orchestrate/command/push.rb:25:in `execute'
from /Users/cbaldauf/.vagrant.d/gems/gems/vagrant-orchestrate-0.0.7/lib/vagrant-orchestrate/command/root.rb:44:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:301:in `cli'
from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/bin/vagrant:174:in `<main>'

@maclennann

maclennann commented 9 years ago

I checked this out briefly this morning, with an eye to making vagrant-winrm-s smarter about which gem it loads. However, where winrm 1.3 has an ignore cert option, version 1.1.3 (which is used by Vagrant) does not. Even after manually adding it for testing via a script, I was unable to get it working.

maclennann commented 9 years ago

The next version of Vagrant will have this out-of-the-box...mostly.

The one problem is that it is hard-coded to allow basic auth only which means we can't do domain authentication. A pull request to vagrant to make that false (or dependent on the presence of '\' in the username or something) probably wouldn't be out of the question.

I confirmed that flipping that bit worked from box Linux and Windows hosts.

maclennann commented 9 years ago

This might Just Work :tm: now. 1.7.4 supports SSL and ignore-cert out of the box.