I monkeypatched 'run' to expect a ~/.caprc file. Basically the same result:
Capistrano::Configuration::Actions::Invocation.module_eval do
alias :run_without_env :run
def run(cmd, options = {}, &block)
if use_caprc then
run_without_env ". ~/.caprc && #{cmd}", options, &block
else
run_without_env cmd, options, &block
end
end
end
Normally I would have just tweaked bashrc, but Capistrano uses /bin/sh, not
bash, so I went for something Cap-specific.
On 2/14/08, John Ward <[EMAIL PROTECTED]> wrote:
>
> I had some issues like this before. When I ssh'd in things worked, when I
> used capistrano it didn't. I believe it was a $PATH issue.
>
> If I remember capistrano connects were not invoking the .profile scripts,
> however it was invoking the.ssh/environment file. Once I added the missing
> path to .ssh/environment it worked. I didn't continue investigating why this
> behaviour occured to be honest after I resolved it.
>
> On 2/14/08, Student <[EMAIL PROTECTED]> wrote:
> >
> >
> > The failures is that mongrel_rail's require "rubygems" statement is
> > failing. This means that $PATH is loaded, but $RUBYLIB is not--a fact
> > that I confirmed through the invoke experiment. Mongrel_rails
> > performs as expected for a given environment.
> >
> > ==
> >
> > I guess I'm going to try to trace the construction of the actual
> > command string (as opposed to the reported one) to see what I can see.
> >
> >
> > On Feb 14, 4:07 am, "John Ward" <[EMAIL PROTECTED]> wrote:
> > > Why don't you ssh onto the box and run the command directly and make
> > sure
> > > all gems and paths are correct. It may be something local rather than
> > > capistrano related.
> > >
> >
> > > On 2/14/08, Student <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > > > Okay. That's truly bizarre. That gets me to my next problem... ;)
> > >
> > > > * executing "sudo -p 'sudo password: ' mongrel_rails
> > cluster::start -
> > > > C /etc/mongrel_cluster/CapPlanner.yml"
> > > > servers: ["devplan.amd.com"]
> > > > [devplan.amd.com] executing command
> > > > ** [out :: devplan.amd.com]
> > > > ** [out :: devplan.amd.com] /CapPlanner/releases/20080214053508-
> > > > branch-10_Deploy_3-r158/ruby/repo/bin/mongrel_rails:9:in `require':
> > > > no such file to load -- rubygems (LoadError)
> > > > ** [out :: devplan.amd.com] from
> > /CapPlanner/releases/20080214053508-
> > > > branch-10_Deploy_3-r158/ruby/repo/bin/mongrel_rails:9
> > > > command finished
> > >
> > > > The problem is that only the path is being added to the sudo
> > > > environment:
> > > > (I have a puts default_environment.to_yaml in config/deploy.rb)
> > >
> > > > C:\CapPlanner\branches\10_Deploy_3>set SUDO="TRUE"
> > > > C:\CapPlanner\branches\10_Deploy_3>cap invoke COMMAND="env"
> > > > cap invoke COMMAND="env"
> > > > GEM_HOME:
> > /CapPlanner/releases/20080214055737-branch-10_Deploy_3-r158/
> > > > ruby/repo
> > > > RUBYLIB:
> > /CapPlanner/releases/20080214055737-branch-10_Deploy_3-r158/
> > > > ruby/lib
> > > > PATH:
> > /CapPlanner/releases/20080214055737-branch-10_Deploy_3-r158/ruby/
> > > > repo/bin:/CapPlanner/releases/20080214055737-branch-10_Deploy
> > > > _3-r158/ruby/bin:$PATH
> > > > GEM_PATH:
> > /CapPlanner/releases/20080214055737-branch-10_Deploy_3-r158/
> > > > ruby/repo
> > > > * executing `invoke'
> > > > * executing "sudo -p 'sudo password: ' env"
> > > > servers: ["devplan.amd.com"]
> > > > Password:
> > > > [devplan.amd.com] executing command
> > > > ** [out :: devplan.amd.com] TERM=xterm
> > > > ** [out :: devplan.amd.com]
> > PATH=/CapPlanner/releases/20080214055737-
> > > > branch-10_Deploy_3-r158/ruby/repo/bin:/CapPlanner/releases/200
> > > >
> > 80214055737-branch-10_Deploy_3-r158/ruby/bin:/usr/local/bin:/bin:/usr/
> > > > bin
> > > > ** [out :: devplan.amd.com] MAIL=/var/mail/nzook
> > > > ** [out :: devplan.amd.com] HOME=/home/nzook
> > > > ** [out :: devplan.amd.com] SHELL=/bin/bash
> > > > ** [out :: devplan.amd.com] LOGNAME=root
> > > > ** [out :: devplan.amd.com] USER=root
> > > > ** [out :: devplan.amd.com] SUDO_COMMAND=/bin/env
> > > > ** [out :: devplan.amd.com] SUDO_USER=nzook
> > > > ** [out :: devplan.amd.com] SUDO_UID=41198
> > > > ** [out :: devplan.amd.com] SUDO_GID=20
> > > > command finished
> > >
> > > > C:\CapPlanner\branches\10_Deploy_3>set SUDO=
> > > > C:\CapPlanner\branches\10_Deploy_3>cap invoke COMMAND="env"
> > > > ---
> > > > GEM_HOME:
> > /CapPlanner/releases/20080214060945-branch-10_Deploy_3-r158/
> > > > ruby/repo
> > > > RUBYLIB:
> > /CapPlanner/releases/20080214060945-branch-10_Deploy_3-r158/
> > > > ruby/lib
> > > > PATH:
> > /CapPlanner/releases/20080214060945-branch-10_Deploy_3-r158/ruby/
> > > > repo/bin:/CapPlanner/releases/20080214060945-branch-10_Deploy
> > > > _3-r158/ruby/bin:$PATH
> > > > GEM_PATH:
> > /CapPlanner/releases/20080214060945-branch-10_Deploy_3-r158/
> > > > ruby/repo
> > > > * executing `invoke'
> > > > * executing "env"
> > > > servers: ["devplan.amd.com"]
> > > > Password:
> > > > [devplan.amd.com] executing command
> > > > ** [out :: devplan.amd.com] GEM_HOME=/CapPlanner/releases/
> > > > 20080214060945-branch-10_Deploy_3-r158/ruby/repo
> > > > ** [out :: devplan.amd.com] SHELL=/bin/bash
> > > > ** [out :: devplan.amd.com] TERM=xterm
> > > > ** [out :: devplan.amd.com] SSH_CLIENT=163.181.210.100 1984 22
> > > > ** [out :: devplan.amd.com] SSH_TTY=/dev/pts/2
> > > > ** [out :: devplan.amd.com] USER=nzook
> > > > ** [out :: devplan.amd.com]
> > PATH=/CapPlanner/releases/20080214060945-
> > > > branch-10_Deploy_3-r158/ruby/repo/bin:/CapPlanner/releases/
> > > >
> > 20080214060945-branch-10_Deploy_3-r158/ruby/bin:/usr/local/bin:/bin:/
> > > > usr/bin
> > > > ** [out :: devplan.amd.com] MAIL=/var/mail/nzook
> > > > ** [out :: devplan.amd.com] _=/bin/env
> > > > ** [out :: devplan.amd.com] PWD=/home/nzook
> > > > ** [out :: devplan.amd.com] HOME=/home/nzook
> > > > ** [out :: devplan.amd.com] SHLVL=2
> > > > ** [out :: devplan.amd.com] LOGNAME=nzook
> > > > ** [out :: devplan.amd.com] GEM_PATH=/CapPlanner/releases/
> > > > 20080214060945-branch-10_Deploy_3-r158/ruby/repo
> > > > ** [out :: devplan.amd.com] SSH_CONNECTION=163.181.210.100 1984
> > > > 10.236.9.197 22
> > > > ** [out :: devplan.amd.com] RUBYLIB=/CapPlanner/releases/
> > > > 20080214060945-branch-10_Deploy_3-r158/ruby/lib
> > > > command finished
> > >
> > > > On Feb 13, 7:54 pm, Jamis Buck <[EMAIL PROTECTED]> wrote:
> > > > > try:
> > >
> > > > > default_run_options[:pty] = true
> > >
> > > > > instead. The default is false.
> > >
> > > > > - Jamis
> > >
> > > > > On Feb 13, 2008, at 6:10 PM, Student wrote:
> > >
> > > > > > Well, I guess I can join the crowd...
> > >
> > > > > > *** [err :: devplan] sudo:
> > > > > > *** [err :: devplan] sorry, you must have a tty to run sudo
> > > > > > *** [err :: devplan]
> > >
> > > > > > Now, I have enough privilege to fix this, but man /etc/sudoers
> > says
> > > > > > that this is required to prevent visible passwords.
> > > > > > default_run_options[:pty] = false doesn't help.
> > >
> > > > > > Any options?
> > >
> > > > > smime.p7s
> > > > > 3KDownload
> >
> >
> > > >
> >
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---