Can now configure what shell to sudo with (default: bash)
This commit is contained in:
parent
c1373f4eca
commit
3c45df0a88
|
@ -11,6 +11,11 @@ module Vagrant
|
|||
attr_writer :private_key_path
|
||||
attr_accessor :forward_agent
|
||||
attr_accessor :forward_x11
|
||||
attr_accessor :sudo_shell
|
||||
|
||||
def initialize
|
||||
@sudo_shell = "bash"
|
||||
end
|
||||
|
||||
def private_key_path
|
||||
File.expand_path(@private_key_path, env.root_path)
|
||||
|
|
|
@ -79,7 +79,7 @@ module Vagrant
|
|||
:user_known_hosts_file => [],
|
||||
:paranoid => false,
|
||||
:config => false)) do |ssh|
|
||||
yield SSH::Session.new(ssh)
|
||||
yield SSH::Session.new(ssh, env)
|
||||
end
|
||||
end
|
||||
rescue Errno::ECONNREFUSED
|
||||
|
|
|
@ -7,9 +7,11 @@ module Vagrant
|
|||
include Util::Retryable
|
||||
|
||||
attr_reader :session
|
||||
attr_reader :env
|
||||
|
||||
def initialize(session)
|
||||
def initialize(session, env)
|
||||
@session = session
|
||||
@env = env
|
||||
end
|
||||
|
||||
# Executes a given command and simply returns true/false if the
|
||||
|
@ -32,7 +34,7 @@ module Vagrant
|
|||
# of `sudo`.
|
||||
def sudo!(commands, options=nil, &block)
|
||||
channel = session.open_channel do |ch|
|
||||
ch.exec("sudo bash -l") do |ch2, success|
|
||||
ch.exec("sudo #{env.config.ssh.sudo_shell} -l") do |ch2, success|
|
||||
# Output each command as if they were entered on the command line
|
||||
[commands].flatten.each do |command|
|
||||
ch2.send_data "#{command}\n"
|
||||
|
|
|
@ -3,9 +3,10 @@ require "test_helper"
|
|||
class SshSessionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@session = mock("session")
|
||||
@env = vagrant_env
|
||||
|
||||
@klass = Vagrant::SSH::Session
|
||||
@instance = @klass.new(@session)
|
||||
@instance = @klass.new(@session, @env)
|
||||
end
|
||||
|
||||
context "exec!" do
|
||||
|
|
Loading…
Reference in New Issue