From f146f4577ea760c08f1b28a76fa8996b94c5b005 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 15 Apr 2016 13:50:42 -0700 Subject: [PATCH] Fail explicitly instead of continuing with a warning if "phd.user" is misconfigured Summary: Fixes T6806. We haven't seen users having issues with `phd.user` in a very long time. Test Plan: - Configured daemons to run as `notepriestley`, got a well-explained exception. - Configured daemons to run as `epriestley`, got a clean start. - Configured daemons with `phd.user=null`, got a clean start. Reviewers: chad, areitz Reviewed By: areitz Subscribers: areitz Maniphest Tasks: T6806 Differential Revision: https://secure.phabricator.com/D15726 --- .../PhabricatorDaemonManagementWorkflow.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php index 447a614600..e0218a741d 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php @@ -224,17 +224,18 @@ abstract class PhabricatorDaemonManagementWorkflow $daemon_script_dir, $config, $this->runDaemonsAsUser); - } catch (Exception $e) { - // Retry without sudo - $console->writeOut( - "%s\n", + } catch (Exception $ex) { + throw new PhutilArgumentUsageException( pht( - '%s command failed. Starting daemon as current user.', - 'sudo')); - $this->executeDaemonLaunchCommand( - $command, - $daemon_script_dir, - $config); + 'Daemons are configured to run as user "%s" in configuration '. + 'option `%s`, but the current user is "%s" and `phd` was unable '. + 'to switch to the correct user with `sudo`. Command output:'. + "\n\n". + '%s', + $phd_user, + 'phd.user', + $current_user, + $ex->getMessage())); } } }