mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 22:40:55 +01:00
Fix "daemons running as wrong user" setup issue
Summary: Fixes T9385. This was accidentally mangled a bit a long time ago by D12797, which was a 1,000-file change which got almost everything right. Simplify the message and fix all the `%s` conversions and how they map to parameters. Test Plan: {F1220400} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9385 Differential Revision: https://secure.phabricator.com/D15722
This commit is contained in:
parent
20bad9a4ba
commit
cd8491ae93
1 changed files with 33 additions and 42 deletions
|
@ -46,49 +46,40 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
|
||||||
->addCommand('phabricator/ $ ./bin/phd start');
|
->addCommand('phabricator/ $ ./bin/phd start');
|
||||||
}
|
}
|
||||||
|
|
||||||
$phd_user = PhabricatorEnv::getEnvConfig('phd.user');
|
$expect_user = PhabricatorEnv::getEnvConfig('phd.user');
|
||||||
$all_daemons = id(new PhabricatorDaemonLogQuery())
|
if (strlen($expect_user)) {
|
||||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
$all_daemons = id(new PhabricatorDaemonLogQuery())
|
||||||
->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE)
|
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||||
->execute();
|
->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE)
|
||||||
foreach ($all_daemons as $daemon) {
|
->execute();
|
||||||
|
foreach ($all_daemons as $daemon) {
|
||||||
if ($phd_user) {
|
$actual_user = $daemon->getRunningAsUser();
|
||||||
if ($daemon->getRunningAsUser() != $phd_user) {
|
if ($actual_user == $expect_user) {
|
||||||
$doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
|
continue;
|
||||||
|
|
||||||
$summary = pht(
|
|
||||||
'At least one daemon is currently running as a different '.
|
|
||||||
'user than configured in the Phabricator %s setting',
|
|
||||||
'phd.user');
|
|
||||||
|
|
||||||
$message = pht(
|
|
||||||
'A daemon is running as user %s while the Phabricator config '.
|
|
||||||
'specifies %s to be %s.'.
|
|
||||||
"\n\n".
|
|
||||||
'Either adjust %s to match %s or start '.
|
|
||||||
'the daemons as the correct user. '.
|
|
||||||
"\n\n".
|
|
||||||
'%s Daemons will try to use %s to start as the configured user. '.
|
|
||||||
'Make sure that the user who starts %s has the correct '.
|
|
||||||
'sudo permissions to start %s daemons as %s',
|
|
||||||
'phd.user',
|
|
||||||
'phd.user',
|
|
||||||
'phd',
|
|
||||||
'sudo',
|
|
||||||
'phd',
|
|
||||||
'phd',
|
|
||||||
phutil_tag('tt', array(), $daemon->getRunningAsUser()),
|
|
||||||
phutil_tag('tt', array(), $phd_user),
|
|
||||||
phutil_tag('tt', array(), $daemon->getRunningAsUser()),
|
|
||||||
phutil_tag('tt', array(), $phd_user));
|
|
||||||
|
|
||||||
$this->newIssue('daemons.run-as-different-user')
|
|
||||||
->setName(pht('Daemons are running as the wrong user'))
|
|
||||||
->setSummary($summary)
|
|
||||||
->setMessage($message)
|
|
||||||
->addCommand('phabricator/ $ ./bin/phd restart');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$summary = pht(
|
||||||
|
'At least one daemon is currently running as the wrong user.');
|
||||||
|
|
||||||
|
$message = pht(
|
||||||
|
'A daemon is running as user %s, but daemons should be '.
|
||||||
|
'running as %s.'.
|
||||||
|
"\n\n".
|
||||||
|
'Either adjust the configuration setting %s or restart the '.
|
||||||
|
'daemons. Daemons should attempt to run as the proper user when '.
|
||||||
|
'restarted.',
|
||||||
|
phutil_tag('tt', array(), $actual_user),
|
||||||
|
phutil_tag('tt', array(), $expect_user),
|
||||||
|
phutil_tag('tt', array(), 'phd.user'));
|
||||||
|
|
||||||
|
$this->newIssue('daemons.run-as-different-user')
|
||||||
|
->setName(pht('Daemon Running as Wrong User'))
|
||||||
|
->setSummary($summary)
|
||||||
|
->setMessage($message)
|
||||||
|
->addPhabricatorConfig('phd.user')
|
||||||
|
->addCommand('phabricator/ $ ./bin/phd restart');
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue