From 80ca559258a99a985f283d9cd954e6434f4ff58e Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Wed, 15 Oct 2014 01:01:43 -0300 Subject: [PATCH] Tweaks to get the changes introduced on GH-317 to work with the sudo wrapper --- lib/vagrant-lxc/driver/cli.rb | 3 +-- templates/sudoers.rb.erb | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-lxc/driver/cli.rb b/lib/vagrant-lxc/driver/cli.rb index 128eb22..d5093a5 100644 --- a/lib/vagrant-lxc/driver/cli.rb +++ b/lib/vagrant-lxc/driver/cli.rb @@ -149,8 +149,7 @@ module Vagrant end def support_version_command? - @sudo_wrapper.run('which', 'lxc-version') - return true + @sudo_wrapper.run('which', 'lxc-version').strip.chomp != '' rescue Vagrant::LXC::Errors::ExecuteError return false end diff --git a/templates/sudoers.rb.erb b/templates/sudoers.rb.erb index dda3c11..55cf5ca 100644 --- a/templates/sudoers.rb.erb +++ b/templates/sudoers.rb.erb @@ -95,12 +95,14 @@ Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-version' Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-ls' Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-info', '--name', /.*/ Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-create', '-B', /.*/, '--template', /.*/, '--name', /.*/, '**' +Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-create', '--version' Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-destroy', '--name', /.*/ Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-start', '-d', '--name', /.*/, '**' Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-stop', '--name', /.*/ Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-shutdown', '--name', /.*/ Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-attach', '--name', /.*/, '**' Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-attach', '-h' +Whitelist.add '<%= cmd_paths['lxc_bin'] %>/lxc-config', 'lxc.lxcpath' ## # Commands from driver/action/remove_temporary_files.rb