driver/cli: Deal with namespaces args for lxc-attach when the sudo wrapper script is in place [GH-300]

This commit is contained in:
Fabio Rehm 2014-07-24 21:45:04 -03:00
parent 752fa9b4e5
commit d3b9d53097
2 changed files with 7 additions and 0 deletions

View file

@ -97,6 +97,11 @@ module Vagrant
opts = cmd.pop opts = cmd.pop
namespaces = Array(opts[:namespaces]).map(&:upcase).join('|') namespaces = Array(opts[:namespaces]).map(&:upcase).join('|')
# HACK: The wrapper script should be able to handle this
if @sudo_wrapper.wrapper_path
namespaces = "'#{namespaces}'"
end
if namespaces if namespaces
if supports_attach_with_namespaces? if supports_attach_with_namespaces?
extra = ['--namespaces', namespaces] extra = ['--namespaces', namespaces]

View file

@ -4,6 +4,8 @@ module Vagrant
# Include this so we can use `Subprocess` more easily. # Include this so we can use `Subprocess` more easily.
include Vagrant::Util::Retryable include Vagrant::Util::Retryable
attr_reader :wrapper_path
def initialize(wrapper_path = nil) def initialize(wrapper_path = nil)
@wrapper_path = wrapper_path @wrapper_path = wrapper_path
@logger = Log4r::Logger.new("vagrant::lxc::sudo_wrapper") @logger = Log4r::Logger.new("vagrant::lxc::sudo_wrapper")