1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 10:12:41 +01:00

Correctly handle case where no ssh keys are found

Summary: If no ssh keys are in phabricator, bin/ssh-auth errors with undefined `$lines`. This fixes that case and explicitly tells the user no rows were found.

Test Plan: Ran bin/ssh-auth before and after change with no ssh keys in the system. Error goes away after change.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: epriestley

CC: epriestley, aran, Korvin

Differential Revision: https://secure.phabricator.com/D7675
This commit is contained in:
Eric Stern 2013-11-30 18:53:19 -08:00 committed by epriestley
parent ba76526185
commit 45c3a605ee

View file

@ -15,6 +15,11 @@ $rows = queryfx_all(
$user_dao->getTableName(), $user_dao->getTableName(),
$ssh_dao->getTableName()); $ssh_dao->getTableName());
if (!$rows) {
echo pht("No keys found.")."\n";
exit(1);
}
$bin = $root.'/bin/ssh-exec'; $bin = $root.'/bin/ssh-exec';
foreach ($rows as $row) { foreach ($rows as $row) {
$user = $row['userName']; $user = $row['userName'];