command/sudoers: Nitpick
* Use Ruby 1.9+ hash syntax * Use % as the BOXES placeholder as it is the same symbol used for I18n placeholders as well
This commit is contained in:
parent
19bccc9ca5
commit
02fefd10c0
1 changed files with 4 additions and 5 deletions
|
@ -6,7 +6,7 @@ module Vagrant
|
||||||
class Sudoers < Vagrant.plugin("2", :command)
|
class Sudoers < Vagrant.plugin("2", :command)
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
options = { :user => ENV['USER'] }
|
options = { user: ENV['USER'] }
|
||||||
|
|
||||||
opts = OptionParser.new do |opts|
|
opts = OptionParser.new do |opts|
|
||||||
opts.banner = "Usage: vagrant lxc sudoers"
|
opts.banner = "Usage: vagrant lxc sudoers"
|
||||||
|
@ -48,7 +48,7 @@ module Vagrant
|
||||||
|
|
||||||
def sudoers_policy(user, command, args)
|
def sudoers_policy(user, command, args)
|
||||||
home = `echo ~#{user}`.chomp
|
home = `echo ~#{user}`.chomp
|
||||||
args = args.gsub /\$\{BOXES\}/, "#{home}/.vagrant.d/boxes"
|
args = args.gsub /%\{BOXES\}/, "#{home}/.vagrant.d/boxes"
|
||||||
"#{user} ALL=(root) NOPASSWD: #{command} #{args}\n"
|
"#{user} ALL=(root) NOPASSWD: #{command} #{args}\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ module Vagrant
|
||||||
{ :cmd => '/bin/su', :args => "root -c sed -e '*' -ibak /var/lib/lxc/*" },
|
{ :cmd => '/bin/su', :args => "root -c sed -e '*' -ibak /var/lib/lxc/*" },
|
||||||
{ :cmd => '/bin/su', :args => "root -c echo '*' >> /var/lib/lxc/*" },
|
{ :cmd => '/bin/su', :args => "root -c echo '*' >> /var/lib/lxc/*" },
|
||||||
{ :cmd => '/usr/bin/lxc-start', :args => '-d --name *' },
|
{ :cmd => '/usr/bin/lxc-start', :args => '-d --name *' },
|
||||||
{ :cmd => '/bin/cp', :args => '${BOXES}/*/lxc/lxc-template /usr/lib/lxc/templates/*' },
|
{ :cmd => '/bin/cp', :args => '%{BOXES}/*/lxc/lxc-template /usr/lib/lxc/templates/*' },
|
||||||
{ :cmd => '/bin/cp', :args => '${BOXES}/*/lxc/lxc-template /usr/share/lxc/templates/*' },
|
{ :cmd => '/bin/cp', :args => '%{BOXES}/*/lxc/lxc-template /usr/share/lxc/templates/*' },
|
||||||
{ :cmd => '/bin/rm', :args => '/usr/lib/lxc/templates/*' },
|
{ :cmd => '/bin/rm', :args => '/usr/lib/lxc/templates/*' },
|
||||||
{ :cmd => '/bin/rm', :args => '/usr/share/lxc/templates/*' },
|
{ :cmd => '/bin/rm', :args => '/usr/share/lxc/templates/*' },
|
||||||
{ :cmd => '/bin/chmod', :args => '+x /usr/lib/lxc/*' },
|
{ :cmd => '/bin/chmod', :args => '+x /usr/lib/lxc/*' },
|
||||||
|
@ -76,7 +76,6 @@ module Vagrant
|
||||||
{ :cmd => '/usr/bin/lxc-destroy', :args => '--name *' }
|
{ :cmd => '/usr/bin/lxc-destroy', :args => '--name *' }
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue