1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +01:00

Skip some repository checks in cluster enviornments

Summary:
Ref T2783. Currently, the repository edit page does some checks agaisnt the local system to look for binaries and files on disk. These checks don't make sense in a cluster environment.

Ideally, we could make a Conduit call to the host (e.g., add something like `diffusion.querysetupstatus`) to do these checks, but since they're pretty basic config things and cluster installs are advanced, it doesn't seem super worthwhile for now.

Test Plan: Saw fewer checks in a cluster repo.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2783

Differential Revision: https://secure.phabricator.com/D11102
This commit is contained in:
epriestley 2014-12-31 11:50:35 -08:00
parent 376729b44c
commit 8c4f3edd8a
2 changed files with 66 additions and 47 deletions

View file

@ -683,6 +683,7 @@ final class DiffusionRepositoryEditMainController
PhabricatorRepository $repository) { PhabricatorRepository $repository) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getRequest()->getUser();
$is_cluster = $repository->getAlmanacServicePHID();
$view = new PHUIStatusListView(); $view = new PHUIStatusListView();
@ -756,6 +757,12 @@ final class DiffusionRepositoryEditMainController
} }
$binaries = array_unique($binaries); $binaries = array_unique($binaries);
if (!$is_cluster) {
// We're only checking for binaries if we aren't running with a cluster
// configuration. In theory, we could check for binaries on the
// repository host machine, but we'd need to make this more complicated
// to do that.
foreach ($binaries as $binary) { foreach ($binaries as $binary) {
$where = Filesystem::resolveBinary($binary); $where = Filesystem::resolveBinary($binary);
if (!$where) { if (!$where) {
@ -807,6 +814,7 @@ final class DiffusionRepositoryEditMainController
} }
} }
} }
}
$doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd'); $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
@ -829,6 +837,12 @@ final class DiffusionRepositoryEditMainController
->execute(); ->execute();
if ($pull_daemon) { if ($pull_daemon) {
// TODO: In a cluster environment, we need a daemon on this repository's
// host, specifically, and we aren't checking for that right now. This
// is a reasonable proxy for things being more-or-less correctly set up,
// though.
$view->addItem( $view->addItem(
id(new PHUIStatusItemView()) id(new PHUIStatusItemView())
->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green')
@ -861,7 +875,12 @@ final class DiffusionRepositoryEditMainController
->setNote($daemon_instructions)); ->setNote($daemon_instructions));
} }
if ($repository->usesLocalWorkingCopy()) {
if ($is_cluster) {
// Just omit this status check for now in cluster environments. We
// could make a service call and pull it from the repository host
// eventually.
} else if ($repository->usesLocalWorkingCopy()) {
$local_parent = dirname($repository->getLocalPath()); $local_parent = dirname($repository->getLocalPath());
if (Filesystem::pathExists($local_parent)) { if (Filesystem::pathExists($local_parent)) {
$view->addItem( $view->addItem(

View file

@ -55,7 +55,7 @@ final class PhabricatorWorkerArchiveTaskQuery
if ($this->ids !== null) { if ($this->ids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn_r, $conn_r,
'ids in (%Ld)', 'id in (%Ld)',
$this->ids); $this->ids);
} }