You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/07/29 19:48:57 UTC

[25/50] [abbrv] airavata-php-gateway git commit: moving hardcoded ssh username to config file

moving hardcoded ssh username to config file


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/36fff79e
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/36fff79e
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/36fff79e

Branch: refs/heads/master
Commit: 36fff79e52b0b66f03c6c352c89b9a7bbd656e6d
Parents: fdf27da
Author: Supun Nakandala <sc...@apache.org>
Authored: Wed Jul 22 00:45:57 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Wed Jul 22 00:45:57 2015 +0530

----------------------------------------------------------------------
 app/config/pga_config.php.template    |  5 +++++
 app/libraries/ExperimentUtilities.php | 10 ++++------
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/36fff79e/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 4d1760f..19c4707 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -102,6 +102,11 @@ return array(
         'experiment-data-absolute-path' => '/var/www/experimentData',
 
         /**
+         * username for the user for accessing the experiment data over ssh
+         */
+        'ssh-user' => 'root',
+
+        /**
          * Advanced experiments options
          */
         'advanced-experiment-options' => '',

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/36fff79e/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index ff61473..0caafd7 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -18,8 +18,6 @@ class ExperimentUtilities
 {
     private static $experimentPath;
 
-    private static $sshUser = "root";
-
     /**
      * Launch the experiment with the given ID
      * @param $expId
@@ -163,7 +161,7 @@ class ExperimentUtilities
 
         $advHandling = new AdvancedOutputDataHandling();
         $hostName = $_SERVER['SERVER_NAME'];
-        $expPathConstant = 'file://' . ExperimentUtilities::$sshUser . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path'];
+        $expPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path'];
 
         $advHandling->outputDataDir = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'],
             $expPathConstant, ExperimentUtilities::$experimentPath);
@@ -290,7 +288,7 @@ class ExperimentUtilities
                         $experimentAssemblySuccessful = false;
                     }
                     $hostName = $_SERVER['SERVER_NAME'];
-                    $experimentInput->value = 'file://' . ExperimentUtilities::$sshUser . '@' . $hostName . ':' . $filePath;
+                    $experimentInput->value = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . $filePath;
                     $experimentInput->type = $applicationInput->type;
 
                 } else {
@@ -406,7 +404,7 @@ class ExperimentUtilities
             $experimentInputs = $experiment->experimentInputs;
             ExperimentUtilities::create_experiment_folder_path();
             $hostName = $_SERVER['SERVER_NAME'];
-            $expPathConstant = 'file://' . ExperimentUtilities::$sshUser . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path'];
+            $expPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path'];
             $outputDataDir = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'],
                 $expPathConstant, ExperimentUtilities::$experimentPath);
             $experiment->userConfigurationData->advanceOutputDataHandling->outputDataDir = $outputDataDir;
@@ -414,7 +412,7 @@ class ExperimentUtilities
             foreach ($experimentInputs as $experimentInput) {
                 if ($experimentInput->type == DataType::URI) {
                     $currentInputPath = $experimentInput->value;
-                    $hostPathConstant = 'file://' . ExperimentUtilities::$sshUser . '@' . $hostName . ':';
+                    $hostPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':';
                     $currentInputPath = str_replace($hostPathConstant, '', $currentInputPath);
                     $parts = explode('/', rtrim($currentInputPath, '/'));
                     $fileName = array_pop($parts);