Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Commit

Permalink
Merge pull request #47 from rjaros87/winrm_transport
Browse files Browse the repository at this point in the history
Customize `winrm.transport` option and add `InstalSh` convergence strategy
  • Loading branch information
tas50 authored Aug 28, 2017
2 parents bfbb359 + 91a9595 commit 7b5cc04
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/chef/provisioning/vagrant_driver/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'chef/provisioning/machine/unix_machine'
require 'chef/provisioning/convergence_strategy/install_msi'
require 'chef/provisioning/convergence_strategy/install_cached'
require 'chef/provisioning/convergence_strategy/install_sh'
require 'chef/provisioning/transport/winrm'
require 'chef/provisioning/transport/ssh'
require 'chef/provisioning/vagrant_driver/version'
Expand Down Expand Up @@ -61,7 +62,7 @@ def allocate_machine(action_handler, machine_spec, machine_options)
}
machine_spec.location['needs_reload'] = true if vm_file_updated
if machine_options[:vagrant_options]
%w(vm.guest winrm.host winrm.port winrm.username winrm.password).each do |key|
%w(vm.guest winrm.host winrm.port winrm.transport winrm.username winrm.password).each do |key|
machine_spec.location[key] = machine_options[:vagrant_options][key] if machine_options[:vagrant_options][key]
end
end
Expand Down Expand Up @@ -381,9 +382,12 @@ def convergence_strategy_for(machine_spec, machine_options)
if machine_spec.location['vm.guest'].to_s == 'windows'
Chef::Provisioning::ConvergenceStrategy::InstallMsi.
new(machine_options[:convergence_options], config)
else
elsif machine_options[:cached_installer] == true
Chef::Provisioning::ConvergenceStrategy::InstallCached.
new(machine_options[:convergence_options], config)
else
Chef::Provisioning::ConvergenceStrategy::InstallSh.
new(machine_options[:convergence_options], config)
end
end

Expand Down Expand Up @@ -412,14 +416,14 @@ def create_winrm_transport(machine_spec)
port = machine_spec.location['winrm.port'] || 5985
port = forwarded_ports[port] if forwarded_ports[port]
endpoint = "http://#{hostname}:#{port}/wsman"
type = :plaintext
type = machine_spec.location['winrm.transport'] || :plaintext
options = {
:user => machine_spec.location['winrm.username'] || 'vagrant',
:pass => machine_spec.location['winrm.password'] || 'vagrant',
:disable_sspi => true
}

Chef::Provisioning::Transport::WinRM.new(endpoint, type, options)
Chef::Provisioning::Transport::WinRM.new(endpoint, type, options, config)
end

def create_ssh_transport(machine_spec)
Expand Down

0 comments on commit 7b5cc04

Please sign in to comment.