Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10801 (closed defect: wontfix)

Opened 2 years ago

Last modified 2 years ago

Order of environment and shell should be switched

Reported by: evan Assigned to: minam
Priority: normal Milestone: 2.x
Component: Capistrano Version: edge
Severity: normal Keywords:
Cc:

Description

I think maybe the environment and shell should be switched. command.rb has:

              command_line = [environment, shell, cmd].compact.join(" ")

This means that if you set linking options in your environment such as LD_LIBRARY_PATH, and use a shell such as sudo -u deploy bash, the sudo strips the linking options from the environment. There is no way around this without monkey-patching Capistrano itself.

Alternatively, Capistrano could accept a global :sudo_user option that it prepends with sudo -u to the command line for every task.

Change History

01/14/08 10:17:39 changed by evan

For others, you can work around it for now by doing:

class Capistrano::Command    
  def environment_with_sudo
    "sudo -u deploy #{environment_without_sudo}"
  end
  
  alias :environment_without_sudo :environment
  alias :environment :environment_with_sudo  
end

at the bottom of deploy.rb.

02/22/08 01:39:55 changed by minam

  • status changed from new to closed.
  • resolution set to wontfix.

The :shell variable was never meant to contain values like "sudo -u deploy bash", but I acknowledge that there isn't really any other way to get that effect at the moment. However, I think supporting :shell values like that would be self-defeating, ultimately. It would be better, in the end, to modify Capistrano as necessary to make it know how to use one user to log in, and another to execute commands.

I'm going to close this ticket. If anyone writes a patch that supports dual users as described, please create a new ticket.