command/sudoers: Remove Cmnd_Alias from sudoers file

Since the wrapper is versioned, we would end up having multiple `LXC`
command aliases, making `sudo` unusable:

```
>>> /etc/sudoers.d/vagrant-lxc-1-0-0-alpha-3-dev: Alias `LXC' already
>>> defined near line 2 <<<
sudo: parse error in /etc/sudoers.d/vagrant-lxc-1-0-0-alpha-3-dev near
line 2
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
```
This commit is contained in:
Fabio Rehm 2014-06-08 23:44:02 -03:00
parent b4376ef995
commit 09f855dc76

View file

@ -167,8 +167,7 @@ Whitelist.run!(ARGV)
def create_sudoers!(user, command) def create_sudoers!(user, command)
sudoers = Tempfile.new('vagrant-lxc-sudoers').tap do |file| sudoers = Tempfile.new('vagrant-lxc-sudoers').tap do |file|
file.puts "# Automatically created by vagrant-lxc" file.puts "# Automatically created by vagrant-lxc"
file.puts "Cmnd_Alias LXC = #{command}" file.puts "#{user} ALL=(root) NOPASSWD: #{command}"
file.puts "#{user} ALL=(root) NOPASSWD: LXC"
end end
sudoers.close sudoers.close
sudoers.path sudoers.path