1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22:41 +01:00
phorge-phorge/src/infrastructure
epriestley ca78c1825a When already running as the daemon user, don't "sudo" daemon commands
Summary:
The cluster synchronization code runs either actively (before returning a response to `git clone`, for example) or passively (routinely, as the daemons update reposiories).

The active sync runs as the web user (if running `git clone http://...`) or the VCS user (if running `git clone ssh://...`). But the passive sync runs as the daemon user.

All of these sync processes need to run actual commands as the daemon user (`git fetch ...`).

For the active ones, we must `sudo`.

For the passive ones, we're already the right user. We run the same code, and end up trying to sudo to ourselves, which `sudo` isn't happy about by default.

Depending on how `sudo` is configured and which users things are running as this might work anyway, but it's silly and if it doesn't work it requires you to go make non-obvious, weird config changes that are unintuitive and somewhat nonsensical. This is probably worse on the balance than adding a bit of complexity to the code.

Instead, test which user we're running as. If it's already the right user, don't sudo.

Test Plan:
  - Ran `bin/repository update --trace` as daemon user, saw no more `sudo`.
  - Ran a `git clone` to make sure that didn't break.

Reviewers: chad, avivey

Reviewed By: avivey

Differential Revision: https://secure.phabricator.com/D16391
2016-08-11 16:41:19 -07:00
..
cluster Correctly disinguish between "0 seconds behind master" and "not replicating" 2016-07-03 18:14:07 -07:00
contentsource Modularize content sources 2016-03-26 11:59:45 -07:00
customfield Improve performance when constructing custom fields for objects 2016-07-31 11:25:58 -07:00
daemon When already running as the daemon user, don't "sudo" daemon commands 2016-08-11 16:41:19 -07:00
diff Improve "thread" rendering of unusually-shaped graphs 2016-07-01 11:15:24 -07:00
edges Log and continue when trying to destroy edges with no edge definition 2016-06-23 06:45:17 -07:00
env Before executing svnserve, change the CWD to a readable directory 2016-05-11 06:48:18 -07:00
events Modernize Hovercard implementation 2015-12-24 12:18:28 -08:00
graph Fix task graph fatal for graphs containing restricted tasks 2016-07-29 07:21:45 -07:00
internationalization Convert Calendar to Modular Transactions 2016-07-13 07:46:33 -07:00
javelin Extend from Phobject 2015-06-15 18:02:27 +10:00
lint/linter Linter fixes 2015-12-03 07:44:23 +11:00
log Extend from Phobject 2015-06-15 18:02:27 +10:00
management Modularize content sources 2016-03-26 11:59:45 -07:00
markup Fix parsing of anchors in Phriction document link syntax 2016-06-08 13:14:33 -07:00
query Make limits and ranges work better with Calendar event queries 2016-07-13 15:39:00 -07:00
sms Various linter fixes 2015-08-11 22:36:55 +10:00
ssh phtize all the things 2015-05-22 21:16:39 +10:00
storage In taskmaster daemons, only close connections which were not used recently 2016-08-11 12:03:56 -07:00
syntax Pass the new default syntax highlighting map to the remarkup engine 2016-05-05 02:51:19 -07:00
testing Make caches misses throw by default intead of inline-generating 2016-06-05 08:51:54 -07:00
time Make translation, timezone and pronoun into real settings 2016-06-02 06:29:47 -07:00
util Make cluster repositories more resistant to freezing 2016-04-25 11:37:31 -07:00
PhabricatorEditor.php Mark some strings for translation 2015-06-09 23:06:52 +10:00