Differential D15943 Diff 38385 src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | public function execute(PhutilArgumentParser $args) { | ||||
list($raw_public_key) = execx('ssh-keygen -y -f %s', $tmp_private); | list($raw_public_key) = execx('ssh-keygen -y -f %s', $tmp_private); | ||||
$key_object = PhabricatorAuthSSHPublicKey::newFromRawKey($raw_public_key); | $key_object = PhabricatorAuthSSHPublicKey::newFromRawKey($raw_public_key); | ||||
$public_key = id(new PhabricatorAuthSSHKeyQuery()) | $public_key = id(new PhabricatorAuthSSHKeyQuery()) | ||||
->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
->withKeys(array($key_object)) | ->withKeys(array($key_object)) | ||||
->withIsActive(true) | |||||
->executeOne(); | ->executeOne(); | ||||
if (!$public_key) { | if (!$public_key) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht( | pht( | ||||
'The public key corresponding to the given private key is not '. | 'The public key corresponding to the given private key is not '. | ||||
'yet known to Phabricator. Associate the public key with an '. | 'yet known to Phabricator. Associate the public key with an '. | ||||
'Almanac device in the web interface before registering hosts '. | 'Almanac device in the web interface before registering hosts '. | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |