Yes! That's great. I put this in my deploy.rb file and it works great.
Thanks for your time and help!
class Capistrano::Logger
alias previous_log_method log
def log(level, message, line_prefix=nil)
message = message.gsub(/--username (\S+)/, "--username <filtered>")
message = message.gsub(/--password (\S+)/, "--password <filtered>")
previous_log_method level, message, line_prefix
end
end
Matt
On 6/27/07, Jamis Buck <[EMAIL PROTECTED]> wrote:
>
>
> Ah, ok. You're not using the cap shell, then. Capistrano::Shell is
> used _only_ for the "cap shell" task, when you are starting an
> interactive shell.
>
> One option is to reduce the verbosity of the output, so that you don't
> see the log messages that spit out the username/password:
>
> cap -v deploy
>
> Beyond that, I'd consider a patch that allowed you to specify a block
> for the logger, which would "sanitize" output before passing it
> through the logger. Something like:
>
> logger.filter { |msg| msg.
> gsub(/--username (\S+)/, "--username <filtered>").
> gsub(/--password (\S+)/, "--password <filtered>") }
>
> - Jamis
>
> On 6/27/07, Matt M. <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > So in this example, I'd like to (at the least) make the
> > "--password=It5A53cr3t" go away:
> >
> > localhost:~/project-x me$ cap deploy
> > * executing `deploy'
> > * executing `deploy:before_update'
> > SVN User: user-abc
> > Password:
> > * executing `deploy:setup'
> > * executing "mkdir -p /usr/local/projects/project-x
> > /usr/local/projects/project-x/releases
> > /usr/local/projects/project-x/shared
> > /usr/local/projects/project-x/shared/system"
> > servers: ["some-domain.com"]
> > Password:
> > [some-domain.com] executing command
> > command finished
> > * executing "umask 002"
> > servers: ["some-domain.com"]
> > [some-domain.com] executing command
> > command finished
> > * executing `deploy:update'
> > ** transaction: start
> > * executing `deploy:update_code'
> > * executing "svn export -q -r1168 --username user-abc --password
> > It5A53cr3t
> > https://subversion.some-domain.com/repos/project-x/trunk/
> > /usr/local/projects/project-x/releases/20070627152315 &&
> > (echo 1168 >
> > /usr/local/projects/project-x/releases/20070627152315/REVISION)"
> > servers: [" some-domain.com"]
> > [some-domain.com] executing command
> >
> >
> > Matt
> >
> >
> >
> >
> >
> > On 6/27/07, Jamis Buck <[EMAIL PROTECTED]> wrote:
> > >
> > > Perhaps I'm misunderstanding how you are using this. Are you using
> > > "cap shell" and then executing commands from the interactive prompt,
> > > or do you mean something else? Can you send an example transcript
> > > where the username/password are showing up?
> > >
> > > - Jamis
> > >
> > > On 6/27/07, Matt M. <[EMAIL PROTECTED]> wrote:
> > > > Hey thanks Jamis, unfortunately that doesn't seem to work. What do
> you
> > > > recommend I do if I don't want the username and password to appear
> when
> > the
> > > > command gets executed?
> > > >
> > > > Matt
> > > >
> > > >
> > > > On 6/27/07, Jamis Buck < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > You can do something like
> > > > >
> > > > > require 'capistrano/shell'
> > > > > class Capistrano::Shell
> > > > > def exec_command(...)
> > > > > # your implementation here
> > > > > end
> > > > > end
> > > > >
> > > > > You _might_ be able to put that in your deploy.rb, and have it
> "just
> > > > > work". I haven't actually tried that, though.
> > > > >
> > > > > - Jamis
> > > > >
> > > > > On 6/26/07, Matt M. <[EMAIL PROTECTED]> wrote:
> > > > > > I see. I realized that as soon as I pressed to "submit" button!
> How
> > do
> > > > you
> > > > > > override a method outside of the class though?
> > > > > >
> > > > > > Matt
> > > > > >
> > > > > >
> > > > > > On 6/26/07, Jamis Buck < [EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > Note that the Capistrano:: Shell.run method is not the same as
> > > > > > >
> > Capistrano::Configuration::Actions::Invocation#run
> > > > > > method. Your
> > > > > > > definition is resulting in an infinite recursive loop. What
> you
> > need
> > > > > > > to do is reimplement the Capistrano::Shell#exec_command
> method, to
> > > > > > > extend the callback used there.
> > > > > > >
> > > > > > > - Jamis
> > > > > > >
> > > > > > > On 6/26/07, goodieboy <[EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > I'd like to override the Capistrano.Shell.run method. The
> reason
> > is
> > > > > > > > that when I do an update, the shell displays the username
> and
> > > > > > > > password. I'd like to test the command data by doing
> something
> > like:
> > > > > > > >
> > > > > > > > def run cmd
> > > > > > > > self.run cmd do |channel,stream,data|
> > > > > > > > if cmd =~ /\-\-password=/
> > > > > > > > # do nothing...
> > > > > > > > end
> > > > > > > > end
> > > > > > > > end
> > > > > > > >
> > > > > > > > I tried that and got:
> > > > > > > > ./config/deploy.rb:41:in `run': stack level too deep
> > > > > > > > (SystemStackError)
> > > > > > > >
> > > > > > > > Any ideas?
> > > > > > > >
> > > > > > > > Thanks!
> > > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
> > >
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---