On Feb 14, 2007, at 9:16 AM, Neil Wilson wrote:
>
> I've never been fond of 'sudo'.
The only real reason for "sudo" is so that Capistrano can know to
look for the password prompt. That's the only difference; when
running with the "sudo" helper, if sudo prompts for a password,
Capistrano will forward that prompt on to the user.
Mike, regarding your patch, I don't know that I want to have
run_method be the default for executing capture requests, since in
environments that allow sudo, all captures will then be executed via
sudo. Perhaps better would be to have an option passed in via the
options hash:
crontab = capture "crontab -l", :via => :sudo, :as => :mike
Or, just
crontab = capture "crontab -l", :as => :mike
since the presence of :as could imply :sudo.
- Jamis
>
> I'd much rather have had 'run_method' as a string that was either
> empty or contained "sudo "
>
> Then we could have
>
> run run_method + "crontab -l"
>
> NeilW
>
>
> On 14 Feb, 06:57, Mike Bailey <[EMAIL PROTECTED]> wrote:
>> I've written a function for deprec to add/remove entries from users
>> crontabs.
>> It needs sudo in order to grab the contents of other users crontabs
>> using 'capture'.
>>
>> I've created a patch to allow this. Does this look OK to be
>> checked in?
>>
>> Should we be using the send method in functions rather than calling
>> 'put' or 'sudo' ?
>> Alternatively should we make these sorts of functions
>> accept :sudo=true/false as an
>> option so we can control it on a call by call basis?
>>
>> - Mike
>>
>> Index: lib/capistrano/actor.rb
>> ===================================================================
>> --- lib/capistrano/actor.rb (revision 6149)
>> +++ lib/capistrano/actor.rb (working copy)
>> @@ -294,7 +294,7 @@
>> # task, collects it's stdout into a string, and returns the
>> string.
>> def capture(command, options={})
>> output = ""
>> - run(command, options.merge(:once => true)) do |ch, stream,
>> data|
>> + send(run_method, command, options.merge(:once => true)) do |
>> ch, stream, data|
>> case stream
>> when :out then output << data
>> when :err then raise "error processing #
>> {command.inspect}: #
>> {data.inspect}"
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---