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

amerzky at cct.lsu.edu amerzky at cct.lsu.edu
Thu Jan 15 05:37:46 CST 2009


User: amerzky
Date: 2009/01/15 05:37 AM

Modified:
 /trunk/adaptors/ssh/ssh_file/
  ssh_file_adaptor.cpp, ssh_file_adaptor_dir_impl.cpp, ssh_file_adaptor_dir_nsdir_impl.cpp, ssh_file_adaptor_sshfs.cpp, ssh_file_adaptor_sshfs.hpp

Log:
 pending commit

File Changes:

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

File [modified]: ssh_file_adaptor.cpp
Delta lines: +2 -1
===================================================================
--- trunk/adaptors/ssh/ssh_file/ssh_file_adaptor.cpp	2009-01-15 11:37:10 UTC (rev 3288)
+++ trunk/adaptors/ssh/ssh_file/ssh_file_adaptor.cpp	2009-01-15 11:37:29 UTC (rev 3289)
@@ -77,12 +77,13 @@
 
     // is not mounted, yet - try to mount it, store a new shared pointer, and
     // return it.
+    SAGA_LOG_ALWAYS (u.get_string ().c_str ());
     TR1::shared_ptr <sshfs> ptr (new sshfs (i, s, u));
 
     if ( ! ptr )
     {
       // cannot mount the fs for some reason - throw a BadParameter
-      SAGA_ADAPTOR_THROW_NO_CONTEXT ("Cannot handle URL schema", saga::BadParameter);
+      SAGA_ADAPTOR_THROW_NO_CONTEXT ("Cannot handle URL", saga::BadParameter);
     }
 
     // got the fs mounted - register it, and return the ptr

File [modified]: ssh_file_adaptor_dir_impl.cpp
Delta lines: +3 -1
===================================================================
--- trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_dir_impl.cpp	2009-01-15 11:37:10 UTC (rev 3288)
+++ trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_dir_impl.cpp	2009-01-15 11:37:29 UTC (rev 3289)
@@ -31,6 +31,8 @@
 
 
     // try to mount the ssh file system
+    SAGA_LOG_ALWAYS (u_.get_string ().c_str ());
+
     sshfs_ = adata->get_sshfs (i_, s_, u_);
 
     // translate URL into local namespace
@@ -38,7 +40,7 @@
 
     if ( t_.get_scheme () != "file" )
     {
-      SAGA_ADAPTOR_THROW ("Cannot handle URL", saga::BadParameter);
+      SAGA_ADAPTOR_THROW ("Cannot translate URL", saga::BadParameter);
     }
 
     // create local dir instance

File [modified]: ssh_file_adaptor_dir_nsdir_impl.cpp
Delta lines: +1 -0
===================================================================
--- trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_dir_nsdir_impl.cpp	2009-01-15 11:37:10 UTC (rev 3288)
+++ trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_dir_nsdir_impl.cpp	2009-01-15 11:37:29 UTC (rev 3289)
@@ -17,6 +17,7 @@
   void dir_cpi_impl::sync_change_dir (saga::impl::void_t & ret, 
                                       saga::url            name)
   {
+    // FIXME when leaving the mounted FS
     try {
       d_.change_dir (sshfs_->translate (name));
       u_ = sshfs_->translate_back (d_.get_url ());

File [modified]: ssh_file_adaptor_sshfs.cpp
Delta lines: +18 -18
===================================================================
--- trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_sshfs.cpp	2009-01-15 11:37:10 UTC (rev 3288)
+++ trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_sshfs.cpp	2009-01-15 11:37:29 UTC (rev 3289)
@@ -18,13 +18,14 @@
     , s_   (s)
     , url_ (u)
   {
-    SAGA_LOG_DEBUG(u.get_string ().c_str ());
+    SAGA_LOG_DEBUG (u.get_string ().c_str ());
 
     // can we handle that URL?
     if ( url_.get_scheme () != "any" &&
          url_.get_scheme () != "ssh" &&
          url_.get_scheme () != ""    )
     {
+      SAGA_LOG_ALWAYS (u.get_string ().c_str ());
       SAGA_ADAPTOR_THROW_NO_CONTEXT ("Cannot handle URL schema", saga::BadParameter);
     }
 
@@ -46,6 +47,7 @@
 
     // get an ssh context from the session which allows to access the host of
     // the given URL
+    std::string err ("Cannot mount file system with sshfs: \n");
     std::vector <saga::context> contexts = s_.list_contexts ();
 
     for ( int i = 0; i < contexts.size (); i++ )
@@ -73,11 +75,13 @@
         {
           return;
         }
+
+        err += error_ + "\n";
       }
     }
 
     // no mount - flag error
-    SAGA_ADAPTOR_THROW_NO_CONTEXT ("Cannot mount file system with sshfs", saga::BadParameter);
+    SAGA_ADAPTOR_THROW_NO_CONTEXT (err.c_str (), saga::NoSuccess);
   }
 
 
@@ -178,8 +182,6 @@
     }
 
 
-#define TICKET_319_IS_CLOSED 1
-#if     TICKET_319_IS_CLOSED
     // create local mount point
     try 
     {
@@ -195,10 +197,6 @@
       SAGA_LOG_ERROR (e.what ());
       SAGA_ADAPTOR_THROW_NO_CONTEXT ("cannot create local mount point", saga::NoSuccess);
     }
-#else
-    SAGA_LOG_ALWAYS("you need to create the mount point manually!");
-    SAGA_LOG_ALWAYS(mount_.c_str ());
-#endif
 
 
     // run mount process
@@ -211,14 +209,18 @@
       proc.add_arg  (mount_);                     // local mount point
       proc.run_sync ();
 
-      if ( proc.fail () )
+      if ( proc.done () )
       { 
-        SAGA_ADAPTOR_THROW_NO_CONTEXT ("mount failed", saga::NoSuccess);
+        mounted_ = true;
+        SAGA_LOG_DEBUG ("new sshfs mounted");
       }
-
-      mounted_ = true;
-      
-      SAGA_LOG_DEBUG("new sshfs mounted");
+      else
+      {
+        error_ = proc.get_err_s ();
+        mounted_ = false;
+        SAGA_LOG_ERROR ("sshfs mount failed");
+        SAGA_LOG_ERROR (error_.c_str ());
+      }
     }
   }
 
@@ -274,8 +276,6 @@
                                      saga::NoSuccess);
     }
 
-    SAGA_LOG_ALWAYS (u.get_path ().c_str ());
-
     ret = "file://localhost/" + mount_ + u.get_path ();
 
     return ret;
@@ -301,13 +301,13 @@
                                      saga::NoSuccess);
     }
 
-    std::string path = u.get_path ();
+    std::string path = saga::url::unescape (u.get_path ());
 
     // check if path points into the mounted name space
     if ( path.find (mount_) != 0 )
     {
       // nop - nothing to do
-      SAGA_ADAPTOR_THROW_NO_CONTEXT ("cannot translate URL back",
+      SAGA_ADAPTOR_THROW_NO_CONTEXT ("Cannot translate URL back",
                                      saga::NoSuccess);
     }
 

File [modified]: ssh_file_adaptor_sshfs.hpp
Delta lines: +2 -0
===================================================================
--- trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_sshfs.hpp	2009-01-15 11:37:10 UTC (rev 3288)
+++ trunk/adaptors/ssh/ssh_file/ssh_file_adaptor_sshfs.hpp	2009-01-15 11:37:29 UTC (rev 3289)
@@ -46,6 +46,8 @@
       std::vector <std::string>   sshfs_opt_;   // options to sshfs
       std::string                 sshfs_mnt_;   // mountpoint base
 
+      std::string                 error_;       // keep last error message
+
       // helper functions
       void check_ini_ (void);
 



More information about the saga-devel mailing list