airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [07/12] airavata-php-gateway git commit: AIRAVATA-2500 SSHAccountProvisioner error reporting
Date Mon, 25 Sep 2017 21:11:01 GMT
AIRAVATA-2500 SSHAccountProvisioner error reporting


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/2782a493
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/2782a493
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/2782a493

Branch: refs/heads/AIRAVATA-2500
Commit: 2782a4939136b7a968f3efb35ceb4c42ee627638
Parents: 2db05f4
Author: Marcus Christie <machrist@iu.edu>
Authored: Thu Sep 7 15:24:07 2017 -0400
Committer: Marcus Christie <machrist@iu.edu>
Committed: Thu Sep 7 16:20:04 2017 -0400

----------------------------------------------------------------------
 app/libraries/URPUtilities.php | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2782a493/app/libraries/URPUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/URPUtilities.php b/app/libraries/URPUtilities.php
index 33b1e5e..27b4c67 100644
--- a/app/libraries/URPUtilities.php
+++ b/app/libraries/URPUtilities.php
@@ -189,24 +189,30 @@ class URPUtilities
                 $computeResource = CRUtilities::get_compute_resource($computeResourceId);
                 $hostname = $computeResource->hostName;
                 $userComputeResourcePreference = null;
-                if( array_key_exists($computeResourceId, $userComputeResourcePreferences))
{
-                    $userComputeResourcePreference = $userComputeResourcePreferences[$computeResourceId];
-                    $accountExists = true;
-                } else if ($sshAccountProvisioner->canCreateAccount) {
-                    $userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId,
$userId, $computeResourceId, $hostname);
-                    $accountExists = true;
-                } else if (Airavata::doesUserHaveSSHAccount(Session::get('authz-token'),
$computeResourceId, $userId)) {
-                    $userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId,
$userId, $computeResourceId, $hostname);
-                    $accountExists = true;
-                } else {
-                    $accountExists = false;
+                $errorMessage = null;
+                $accountExists = false;
+                try {
+                    if( array_key_exists($computeResourceId, $userComputeResourcePreferences))
{
+                        $userComputeResourcePreference = $userComputeResourcePreferences[$computeResourceId];
+                        $accountExists = true;
+                    } else if ($sshAccountProvisioner->canCreateAccount) {
+                        $userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId,
$userId, $computeResourceId, $hostname);
+                        $accountExists = true;
+                    } else if (Airavata::doesUserHaveSSHAccount(Session::get('authz-token'),
$computeResourceId, $userId)) {
+                        $userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId,
$userId, $computeResourceId, $hostname);
+                        $accountExists = true;
+                    }
+                } catch (Exception $ex) {
+                    Log::error("Failed to setup SSH Account for " . $userId . " on $hostname");
+                    Log::error($ex);
+                    $errorMessage = $ex->getMessage();
                 }
                 $results[] = array(
                     "hostname" => $hostname,
                     "userComputeResourcePreference" => $userComputeResourcePreference,
                     "accountExists" => $accountExists,
                     "additionalInfo" => $computeResourcePreference->sshAccountProvisionerAdditionalInfo,
-                    "errorMessage" => "TODO"
+                    "errorMessage" => $errorMessage
                 );
             }
         }


Mime
View raw message