From d3b9d530974268486e1f6a0125140360d44d96f3 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Thu, 24 Jul 2014 21:45:04 -0300 Subject: [PATCH] driver/cli: Deal with namespaces args for lxc-attach when the sudo wrapper script is in place [GH-300] --- lib/vagrant-lxc/driver/cli.rb | 5 +++++ lib/vagrant-lxc/sudo_wrapper.rb | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/vagrant-lxc/driver/cli.rb b/lib/vagrant-lxc/driver/cli.rb index d378288..a2aba8a 100644 --- a/lib/vagrant-lxc/driver/cli.rb +++ b/lib/vagrant-lxc/driver/cli.rb @@ -97,6 +97,11 @@ module Vagrant opts = cmd.pop 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 supports_attach_with_namespaces? extra = ['--namespaces', namespaces] diff --git a/lib/vagrant-lxc/sudo_wrapper.rb b/lib/vagrant-lxc/sudo_wrapper.rb index 2891c52..406c0f0 100644 --- a/lib/vagrant-lxc/sudo_wrapper.rb +++ b/lib/vagrant-lxc/sudo_wrapper.rb @@ -4,6 +4,8 @@ module Vagrant # Include this so we can use `Subprocess` more easily. include Vagrant::Util::Retryable + attr_reader :wrapper_path + def initialize(wrapper_path = nil) @wrapper_path = wrapper_path @logger = Log4r::Logger.new("vagrant::lxc::sudo_wrapper")