Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepository.php
Show First 20 Lines • Show All 1,941 Lines • ▼ Show 20 Lines | if ($never_proxy) { | ||||
'This repository request (for repository "%s") has been '. | 'This repository request (for repository "%s") has been '. | ||||
'incorrectly routed to a cluster host (with device name "%s", '. | 'incorrectly routed to a cluster host (with device name "%s", '. | ||||
'and hostname "%s") which can not serve the request.'. | 'and hostname "%s") which can not serve the request.'. | ||||
"\n\n". | "\n\n". | ||||
'The Almanac device address for the correct device may improperly '. | 'The Almanac device address for the correct device may improperly '. | ||||
'point at this host, or the "device.id" configuration file on '. | 'point at this host, or the "device.id" configuration file on '. | ||||
'this host may be incorrect.'. | 'this host may be incorrect.'. | ||||
"\n\n". | "\n\n". | ||||
'Requests routed within the cluster by Phabricator are always '. | 'Requests routed within the cluster are always '. | ||||
'expected to be sent to a node which can serve the request. To '. | 'expected to be sent to a node which can serve the request. To '. | ||||
'prevent loops, this request will not be proxied again.'. | 'prevent loops, this request will not be proxied again.'. | ||||
"\n\n". | "\n\n". | ||||
"%s", | "%s", | ||||
$this->getDisplayName(), | $this->getDisplayName(), | ||||
$local_device, | $local_device, | ||||
php_uname('n'), | php_uname('n'), | ||||
$request_type)); | $request_type)); | ||||
▲ Show 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | if ($viewer->isOmnipotent()) { | ||||
$public_path = AlmanacKeys::getKeyPath('device.pub'); | $public_path = AlmanacKeys::getKeyPath('device.pub'); | ||||
try { | try { | ||||
$public_key = Filesystem::readFile($public_path); | $public_key = Filesystem::readFile($public_path); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
throw new PhutilAggregateException( | throw new PhutilAggregateException( | ||||
pht( | pht( | ||||
'Unable to read device public key while attempting to make '. | 'Unable to read device public key while attempting to make '. | ||||
'authenticated method call within the Phabricator cluster. '. | 'authenticated method call within the cluster. '. | ||||
'Use `%s` to register keys for this device. Exception: %s', | 'Use `%s` to register keys for this device. Exception: %s', | ||||
'bin/almanac register', | 'bin/almanac register', | ||||
$ex->getMessage()), | $ex->getMessage()), | ||||
array($ex)); | array($ex)); | ||||
} | } | ||||
$private_path = AlmanacKeys::getKeyPath('device.key'); | $private_path = AlmanacKeys::getKeyPath('device.key'); | ||||
try { | try { | ||||
$private_key = Filesystem::readFile($private_path); | $private_key = Filesystem::readFile($private_path); | ||||
$private_key = new PhutilOpaqueEnvelope($private_key); | $private_key = new PhutilOpaqueEnvelope($private_key); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
throw new PhutilAggregateException( | throw new PhutilAggregateException( | ||||
pht( | pht( | ||||
'Unable to read device private key while attempting to make '. | 'Unable to read device private key while attempting to make '. | ||||
'authenticated method call within the Phabricator cluster. '. | 'authenticated method call within the cluster. '. | ||||
'Use `%s` to register keys for this device. Exception: %s', | 'Use `%s` to register keys for this device. Exception: %s', | ||||
'bin/almanac register', | 'bin/almanac register', | ||||
$ex->getMessage()), | $ex->getMessage()), | ||||
array($ex)); | array($ex)); | ||||
} | } | ||||
$client->setSigningKeys($public_key, $private_key); | $client->setSigningKeys($public_key, $private_key); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 649 Lines • Show Last 20 Lines |