Hi Greg,
By design Capistrano will ignore a user's login files (~/.profile,
~/.bash_login, /etc/profile, and the rest (system dependent). You should
always endeavour to set the full path to executables.
An example might be:
set :usermod, '/usr/sbin/usermod'
This way you'll also need to modify the task in question (which is an
extension in your app, as it's not a standard part of the deploy) to
something like run("#{usermod} --gid") (so, variable interpolation)
The alternative, if you don't wish to do that is to use the
:default_environment (magic undocumented) variable, there's a short and
sweet guide here on RVM's site about how it is used, but you can use that to
set the environmental variables.
This second method might be a short-term solution, but will pollute the logs
and output with this stuff before every command that is run(). Here's an
example:
set :default_environment, {
'PATH' => "/usr/local/bin:/usr/sbin:$PATH",
I hope this helps Greg!
- Lee H
On 5 August 2010 04:15, Greg Pederson <[email protected]> wrote:
> Hi All,
> I wonder if someone may be able to point me in the right direction
> with an issue I'm having.
>
> I inherited an app and the staging was pointed to the previous dev's
> server. So I updated the deploy/staging.rb file and ran
> cap staging deploy:setup
>
> but failed with
> * executing "sudo -p 'sudo password: ' usermod --gid
> app_scan_staging --home /var/www/scan_staging app_scan_staging"
> servers: ["scandesign.com"]
> [scandesign.com] executing command
> ** [out :: scandesign.com] sudo: usermod: command not found
> command finished
> failed: "sh -c 'sudo -p '\\''sudo password: '\\'' usermod --gid
> app_scan_staging --home /var/www/scan_staging app_scan_staging'" on
> scandesign.com
>
> I went into my server as the user that's set in the deploy.rb which is
> set :user, "scandesignwebsite"
>
> and saw that usermod wasn't found. So I added /usr/sbin to that
> user's path
> [scandesignwebs...@app01 ~]$ echo $PATH
> /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/scandesignwebsite/
> bin:/usr/sbin
>
> I then ran the failing command manually with no problem
> [scandesignwebs...@app01 ~]$ sudo usermod --gid app_scan_staging --
> home /var/www/scan_staging app_scan_staging
> Password:
> [scandesignwebs...@app01 ~]$
>
>
> However, when I try to run cap staging deploy:setup again it still
> fails because of usermod
>
> And here are the versions I'm running at the moment
> greg-pedersons-computer-2:scandesign gspederson$ cap --version
> Capistrano v2.5.18
> greg-pedersons-computer-2:scandesign gspederson$ ruby --version
> ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin9]
>
> Thanks in advance for your help.
> Greg
>
> --
> * You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to
> [email protected]<capistrano%[email protected]>For
> more options, visit this group at
> http://groups.google.com/group/capistrano?hl=en
--
* You received this message because you are subscribed to the Google Groups
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/capistrano?hl=en