Skip to content

Switch from using a global sudo to su calls per-rake

Ramya Authappan requested to merge master-5960 into master

Created by: ghost

The initial sudo fails from non-tty, and is not best practice. This switches to su for the calls needing the gitlab environment.

Not all servers have sudo. They should, but not all do. Thus init.d scripts typically use su instead when feasible. sudo by default does not allow execution (even as root) without a tty, thus the gitlab script broke down when not manually invoked (via Puppet or on boot, for instance).

I was unable to emulate the initial call to sudo (basically rerunning the script as git user) with su, although it might be possible with some work. Instead I switched to wrapping individual rake calls with su. File removals could also be wrapped in a similar fashion if there is some security concern (there should not be).

Merge request reports

Loading