Skip to content

Commit

Permalink
Updated sudo_script to sudo to any user.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Aug 26, 2012
1 parent 5f4cf89 commit 288ef5d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rubber/recipes/rubber/utils.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -170,9 +170,12 @@ def run_script(name, contents, opts = {})
end end


def sudo_script(name, contents, opts = {}) def sudo_script(name, contents, opts = {})
user = opts.delete(:as)
args = opts.delete(:script_args) args = opts.delete(:script_args)
script = prepare_script(name, contents) script = prepare_script(name, contents)
run "#{sudo} bash -l #{script} #{args}", opts
sudo_args = user ? "-H -u #{user}" : ""
run "#{sudo} #{sudo_args} bash -l #{script} #{args}", opts
end end


def top.rsudo(command, opts = {}, &block) def top.rsudo(command, opts = {}, &block)
Expand Down

0 comments on commit 288ef5d

Please sign in to comment.