[Saga-devel] saga SVN commit 3326: /trunk/adaptors/ssh/

amerzky at cct.lsu.edu amerzky at cct.lsu.edu
Sat Jan 17 11:12:14 CST 2009


User: amerzky
Date: 2009/01/17 11:12 AM

Modified:
 /trunk/adaptors/ssh/ssh_file/
  ssh_file_adaptor_sshfs.cpp
 /trunk/adaptors/ssh/ssh_job/
  ssh_job_service.cpp, ssh_job_service.hpp

Log:
 allow to specify userinfo in the URL

File Changes:

Directory: /trunk/adaptors/ssh/ssh_file/
========================================

File [modified]: ssh_file_adaptor_sshfs.cpp
Delta lines: +9 -0
===================================================================
--- trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_sshfs.cpp	2009-01-17 16:50:09 UTC (rev 3325)
+++ trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_sshfs.cpp	2009-01-17 17:11:59 UTC (rev 3326)
@@ -60,8 +60,17 @@
       {
         std::cout << " == matching ctype! \n"; 
         ctx_  = contexts[i];
+
+        // FIXME: check if attribs exist
         user_ = ctx_.get_attribute ("UserID");
 
+        // the URL may actually have a userid fixed
+        if ( "" != url_.get_userinfo () )
+        {
+          user_ = url_.get_userinfo ();
+        }
+
+
         // default user
         if ( user_ == "" ) { user_ = "root"; }
 

Directory: /trunk/adaptors/ssh/ssh_job/
=======================================

File [modified]: ssh_job_service.cpp
Delta lines: +46 -2
===================================================================
--- trunk/adaptors/ssh/ssh_job/ssh_job_service.cpp	2009-01-17 16:50:09 UTC (rev 3325)
+++ trunk/adaptors/ssh/ssh_job/ssh_job_service.cpp	2009-01-17 17:11:59 UTC (rev 3326)
@@ -73,8 +73,11 @@
 
     for ( int i = 0; i < contexts.size (); i++ )
     {
+      dump_context (contexts[i]);
+      
       if ( contexts[i].get_attribute ("Type") == "ssh" )
       {
+        SAGA_LOG_ALWAYS ("Using this context");
         ssh_contexts.push_back (contexts[i]);
       }
     }
@@ -103,14 +106,25 @@
     //
     // FIXME: we need to be able to create multiple default ssh contexts
 
-    for ( int i = 0; i < ssh_contexts.size (); i++ )
+    for ( int j = 0; j < ssh_contexts.size (); j++ )
     {
       // try that context
-      ctx_  = contexts[i];
+      ctx_  = ssh_contexts[j];
 
+      dump_context (ctx_);
+
+
+      // FIXME: check if attribs exist
       key_  = ctx_.get_attribute ("UserKey");
       user_ = ctx_.get_attribute ("UserID");
 
+      // the URL may actually have a userid fixed
+      if ( "" != rm_.get_userinfo () )
+      {
+        user_ = rm_.get_userinfo ();
+      }
+
+
       saga::adaptors::utils::process proc;
 
       if ( ini_["distribute_idendity"] == "yes"  ||
@@ -217,6 +231,36 @@
     SAGA_ADAPTOR_THROW ("Not Implemented", saga::NotImplemented);
   }
 
+  void job_service_cpi_impl::dump_context (saga::context c)
+  {
+    std::cout << " --------------------------------------\n";
+
+    std::vector <std::string> attribs = c.list_attributes ();
+
+    for ( int i = 0; i < attribs.size (); i++ )
+    {
+      std::string key = attribs[i];
+      std::string val;
+
+      if ( c.attribute_is_vector (key) )
+      {
+        std::vector <std::string> vals = c.get_vector_attribute (key);
+        for ( int j = 0; j < vals.size (); j++ )
+        {
+          val += vals[j] + " ";
+        }
+      }
+      else
+      {
+        val = c.get_attribute (key);
+      }
+
+      std::cout << key << " \t: " << val << std::endl;
+    }
+
+    std::cout << " --------------------------------------\n";
+  }
+
 } // namespace ssh_job
 ////////////////////////////////////////////////////////////////////////
 

File [modified]: ssh_job_service.hpp
Delta lines: +3 -0
===================================================================
--- trunk/adaptors/ssh/ssh_job/ssh_job_service.hpp	2009-01-17 16:50:09 UTC (rev 3325)
+++ trunk/adaptors/ssh/ssh_job/ssh_job_service.hpp	2009-01-17 17:11:59 UTC (rev 3326)
@@ -65,6 +65,9 @@
       std::map <std::string, std::string>  ini_;
       std::map <std::string, std::string>  env_;
 
+      void dump_context (saga::context c);
+
+
     public:
       // constructor of the job_service cpi
       job_service_cpi_impl  (proxy                           * p, 



More information about the saga-devel mailing list