You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2018/10/02 18:41:18 UTC
[airavata-php-gateway] 02/03: Check if ssh account setup is complete
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git
commit 12c9c9b9399a5f330dddcd0e3d6bba9b3c4bc6e7
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Tue Oct 2 14:18:09 2018 -0400
Check if ssh account setup is complete
---
app/libraries/URPUtilities.php | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/app/libraries/URPUtilities.php b/app/libraries/URPUtilities.php
index c65197b..da22b98 100644
--- a/app/libraries/URPUtilities.php
+++ b/app/libraries/URPUtilities.php
@@ -207,7 +207,9 @@ class URPUtilities
// If a $userComputeResourcePreference exists but isn't
// validated some error must have occurred the last time
// it was attempted to be setup. We'll try to set it up again.
- if (!$userComputeResourcePreference->validated) {
+ // Also, the setup may be incomplete in which case we
+ // should also try to setup it up again.
+ if (!$userComputeResourcePreference->validated || !URPUtilities::is_ssh_account_setup_complete($user_id, $computeResourceId, $userComputeResourcePreference)) {
$userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname, $userComputeResourcePreference);
}
} else if ($sshAccountProvisioner->canCreateAccount) {
@@ -245,6 +247,15 @@ class URPUtilities
return $sshAccountProvisionersByName;
}
+ private static function is_ssh_account_setup_complete($userId, $computeResourceId, $userComputeResourcePreference)
+ {
+ return Airavata::isSSHSetupCompleteForUserComputeResourcePreference(
+ Sesssion::get('authz-token'),
+ $computeResourceId,
+ $userComputeResourcePreference->resourceSpecificCredentialStoreToken
+ );
+ }
+
private static function setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname, $userComputeResourcePreference=null)
{
if (empty($userComputeResourcePreference)) {
@@ -266,4 +277,4 @@ class URPUtilities
}
}
-?>
\ No newline at end of file
+?>