[Saga-devel] saga SVN commit 3253: /trunk/adaptors/aws/

amerzky at cct.lsu.edu amerzky at cct.lsu.edu
Sat Jan 10 11:07:47 CST 2009


User: amerzky
Date: 2009/01/10 11:07 AM

Removed:
 /trunk/adaptors/aws/internal/
  aws_helper.cpp, aws_helper.hpp

Modified:
 /trunk/adaptors/aws/
  README
 /trunk/adaptors/aws/aws_context/
  Makefile, aws_context_adaptor.cpp, aws_context_adaptor.hpp
 /trunk/adaptors/aws/aws_job/
  Makefile, aws_job.cpp, aws_job.hpp, aws_job_adaptor.cpp, aws_job_adaptor.hpp, aws_job_service.cpp, aws_job_service.hpp
 /trunk/adaptors/aws/external/ec2-api-tools/bin/
  Makefile
 /trunk/adaptors/aws/external/ec2-api-tools/lib/
  Makefile
 /trunk/adaptors/aws/internal/
  Makefile

Log:
 clean up.  Should now play nicely with saga-lite, amongst other things.
 A

File Changes:

Directory: /trunk/adaptors/aws/
===============================

File [modified]: README
Delta lines: +20 -5
===================================================================
--- trunk/adaptors/aws/README	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/README	2009-01-10 17:07:03 UTC (rev 3253)
@@ -203,21 +203,36 @@
 
   - boot some existing image to start from
   - login, and do all the changes you want to do
-  - copy (via scp) your aws keys to the machine, into /tmp/ec2_keys
-  - create a new image with
+  - copy (via scp) your aws keys to the machine, into /mnt/ec2_keys
+    scp -o StrictHostKeyChecking=no -i /tmp/saga.aws_private_ec2.pem root@<ip>:/mnt/ec2_keys
+  - on the VM, create a new image with
     ec2-bundle-vol -d /mnt \          # exclude from image
                    -k /mnt/ec2_keys/ec2-key.pem \
                    -c /mnt/ec2_keys/ec2-cert.pem \
                    -u 189011143168 \  # aws user id
                    -r i386 \          # architecture
                    -p hardy_saga      # name
-  - upload image to the S3 bucket (gets created)
+  - on the VM, upload image to the S3 bucket (gets created)
     ec2-upload-bundle -b saga-images \                   # bucket
                       -m /mnt/hardy_saga.manifest.xml \  # image description
-                      -a 'publicaccesskey' \
-                      -s 'privateaccesskey'
+                      -a `cat /mnt/ec2_keys/ec2-access-key.txt`
+                      -s `cat /mnt/ec2_keys/ec2-access-cert.txt`
   - register image so that it can be used in EC2 for booting a VM, with
     ec2-register /saga-images/hardy_saga.manifest.xml
   - an image can be unregistered, with
     ec2-deregister <image id>
 
+  - note that there is a race condition: the VM image id is configured in a
+    saga.ini file.  If that file is part of an image, it will contain the 
+    wrong image, as of time of image snapshot cration, the image ID can not yet
+    be known.
+
+
+-----------------------------------------------------------
+HOWTO log in into a ec2 instance
+
+  - public_ip = ec2-describe-instances -> grep for public IP
+  - proxy     = grep for in adaptor ini (/tmp/saga.aws_private_ec2.pem)
+  - ssh -o StrictHostKeyChecking=no -i <proxy> root@<public_ip>
+  - ssh -o StrictHostKeyChecking=no -i /tmp/saga.aws_private_ec2.pem root at ec2-174-129-153-102.compute-1.amazonaws.com
+

Directory: /trunk/adaptors/aws/aws_context/
===========================================

File [modified]: Makefile
Delta lines: +0 -1
===================================================================
--- trunk/adaptors/aws/aws_context/Makefile	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_context/Makefile	2009-01-10 17:07:03 UTC (rev 3253)
@@ -8,7 +8,6 @@
 
 SAGA_SRC          = $(wildcard *.cpp)
 SAGA_OBJ          = $(SAGA_SRC:%.cpp=%.o)
-SAGA_OBJ         += ../internal/aws_helper.o
 
 SAGA_ADAPTOR_TYPE = context
 SAGA_ADAPTOR_NAME = aws_context

File [modified]: aws_context_adaptor.cpp
Delta lines: +106 -29
===================================================================
--- trunk/adaptors/aws/aws_context/aws_context_adaptor.cpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_context/aws_context_adaptor.cpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -10,19 +10,12 @@
 #include <sys/stat.h>
 
 
-#include <boost/process.hpp>
-
-#include "../internal/aws_helper.hpp"
 #include "aws_context_adaptor.hpp"
 
 #include <saga/saga/adaptors/config.hpp>
 #include <saga/saga/adaptors/adaptor.hpp>
 #include <saga/saga/adaptors/attribute.hpp>
 
-namespace aws_detail
-{
-}
-
 namespace aws_context_adaptor 
 {
   ///////////////////////////////////////////////////////////////////////////////
@@ -47,7 +40,7 @@
   {
     try 
     {
-      ini_ = aws_detail::get_ini (adap_ini);
+      get_ini (adap_ini);
     }
     catch ( const saga::exception & e )
     {
@@ -168,6 +161,14 @@
 
       ini_ = adata->ini_[type];
 
+      env_["JAVA_HOME"]       = ini_["java_home"];
+      env_["EC2_HOME"]        = ini_["ec2_home"];
+      env_["EC2_GSG_KEY"]     = ini_["ec2_proxy"];
+      env_["EC2_PRIVATE_KEY"] = ini_["ec2_key"];
+      env_["EC2_CERT"]        = ini_["ec2_cert"];
+      env_["EC2_URL"]         = ini_["ec2_url"];
+    
+
       cert_info_t ci;
 
       // this call looks for a valid cert in a default location
@@ -205,48 +206,48 @@
 
     adaptor_data adata (this);
 
+    saga::adaptors::utils::process proc (env_);    
+
+    // check if file is not yet present
     struct stat buf;
     if ( 0 != ::stat (ini_["ec2_proxy"].c_str (), &buf) &&
          ( errno == ENOENT  ||
            errno == ENOTDIR )                  )
     {
-      std::vector <std::string> args;
+      proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-delete-keypair");
+      
+      proc.add_arg (ini_["ec2_keypair_name"]);
 
-      args.push_back (ini_["ec2_keypair_name"]);
+      proc.run_sync ();
 
-      try
-      {
-        (void) aws_detail::run_process (ini_["ec2_home"]
-                                        + "/bin/ec2-delete-keypair", args, ini_);
-      }
-      catch ( ... )
-      {
-        // do nothing
-      }
+      // we don't care if that fails, really
 
 
-      args.clear ();
-      args.push_back (ini_["ec2_keypair"]);
+      proc.set_cmd    (ini_["ec2_home"] + "/bin/ec2-add-keypair");
 
-      std::vector <std::string> reply = aws_detail::run_process
-        (ini_["ec2_home"] + "/bin/ec2-add-keypair", args, ini_);
+      proc.clear_args ();
+      proc.add_arg    (ini_["ec2_keypair"]);
 
-      std::fstream ec2_proxy_file (ini_["ec2_proxy"].c_str (), std::fstream::out);
+      proc.run_sync ();
 
-      for ( unsigned int i = 0; i < reply.size (); i++ )
+      if ( proc.fail () )
       {
-        ec2_proxy_file << reply[i] << std::endl;
+        SAGA_ADAPTOR_THROW ("Could not add keypair", saga::NoSuccess);
       }
 
+      std::fstream ec2_proxy_file (ini_["ec2_proxy"].c_str (), std::fstream::out);
+
+      ec2_proxy_file << proc.get_out_s () << std::endl;
+
       ec2_proxy_file.close ();
 
       ::chmod (ini_["ec2_proxy"].c_str (), S_IRUSR | S_IWUSR);
     }
 
-    // FIXME: that idendity key works only for EC2!  Any way to retrieve that dynamically?
+    // FIXME: that idendity key works only for EC2!  For _my_ account!! ;-)
+    // Any way to retrieve that dynamically?
     ci.identity = "3PSC2BHR6HKG76S37P46KMNSZUCDRU22";
     ci.path     = ini_["ec2_proxy"];
-
     ci.success  = true;
 
     return ci;
@@ -265,7 +266,7 @@
     adaptor_data adata (this);
 
     saga::adaptors::attribute attr (this);
-    std::vector <std::string> types = aws_detail::split (adata->ini_["defaults"]["cloud_names"], ' ');
+    std::vector <std::string> types = saga::adaptors::utils::split (adata->ini_["defaults"]["cloud_names"], ' ');
 
     if ( attr.attribute_exists (saga::attributes::context_type) )
     {
@@ -289,5 +290,81 @@
   //
   ///////////////////////////////////////////////////////////////////////////////
 
+
+
+  ///////////////////////////////////////////////////////////////////////////////
+  //
+  // parse the adaptor ini, and extract all information into a map hierarchy
+  //
+  void context_adaptor::get_ini (saga::ini::ini const adap_ini)
+  {
+    if ( ! adap_ini.has_entry ("cloud_names" ) ||
+         ! adap_ini.has_entry ("ec2_keystore") || 
+         ! adap_ini.has_entry ("java_home"   ) ||
+         ! adap_ini.has_entry ("ec2_home"    ) )
+    {
+      SAGA_ADAPTOR_THROW_NO_CONTEXT ("Adaptor needs the 'cloud_names' key.",
+                                     saga::NoSuccess);
+    }
+
+    std::map <std::string, std::string> defaults = adap_ini.get_entries ();
+
+    ini_["defaults"] = defaults;
+
+
+    // on default, don't keep VMs alive
+    if ( ! adap_ini.has_entry ("ec2_keepalive" ) )
+    {
+      ini_["defaults"]["ec2_keepalive"] = "false";
+    }
+
+
+    std::vector <std::string> cloud_names = saga::adaptors::utils::split (ini_["defaults"]["cloud_names"], ' ');
+
+    for ( unsigned int i = 0; i < cloud_names.size (); i++ )
+    {
+      std::string name = cloud_names[i];
+
+      if ( ! adap_ini.has_section (name) )
+      {
+        SAGA_ADAPTOR_THROW_NO_CONTEXT ((std::string ("Adaptor needs preferences to be set."
+                                                     " for that cloud type: ") + name).c_str (),
+                                       saga::NoSuccess);
+      }
+
+      saga::ini::ini sub_prefs = adap_ini.get_section (name);
+
+      if ( ! sub_prefs.has_entry ("ec2_type"        ) ||
+           ! sub_prefs.has_entry ("ec2_proxy"       ) ||
+           ! sub_prefs.has_entry ("ec2_key"         ) ||
+           ! sub_prefs.has_entry ("ec2_cert"        ) ||
+           ! sub_prefs.has_entry ("ec2_url"         ) ||
+           ! sub_prefs.has_entry ("ec2_keypair_name") ||
+           ! sub_prefs.has_entry ("ec2_keypair"     ) ||
+           ! sub_prefs.has_entry ("ec2_instance"    ) )
+      {
+        SAGA_ADAPTOR_THROW_NO_CONTEXT ((std::string ("Settings incomplete for cloud type ") + name).c_str (),
+                                       saga::NoSuccess);
+      }
+
+
+      ini_[name]["cloud_names"  ] = ini_["defaults"]["cloud_names"  ];
+      ini_[name]["ec2_keystore" ] = ini_["defaults"]["ec2_keystore" ];
+      ini_[name]["java_home"    ] = ini_["defaults"]["java_home"    ];
+      ini_[name]["ec2_home"     ] = ini_["defaults"]["ec2_home"     ];
+      ini_[name]["ec2_keepalive"] = ini_["defaults"]["ec2_keepalive"];
+
+      
+      std::map <std::string, std::string> settings = sub_prefs.get_entries ();
+      std::map <std::string, std::string> :: iterator it;
+
+      for ( it = settings.begin (); it != settings.end (); it++ )
+      {
+        ini_[name][(*it).first] = (*it).second;
+      }
+    }
+
+  }
+
 } // namespace aws_context_adaptor 
 

File [modified]: aws_context_adaptor.hpp
Delta lines: +11 -2
===================================================================
--- trunk/adaptors/aws/aws_context/aws_context_adaptor.hpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_context/aws_context_adaptor.hpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -25,12 +25,12 @@
   class context_adaptor : public saga::adaptor
   {
     public:
-      aws_detail::aws_ini_map_t ini_;
-
       typedef saga::impl::v1_0::op_info         op_info;  
       typedef saga::impl::v1_0::cpi_info        cpi_info;
       typedef saga::impl::v1_0::preference_type preference_type;
 
+      std::map <std::string, std::map <std::string, std::string> > ini_;
+
       context_adaptor (void) 
       {
       }
@@ -50,6 +50,13 @@
 
       saga::impl::adaptor_selector::adaptor_info_list_type 
         adaptor_register (saga::impl::session * s);
+
+
+      ///////////////////////////////////////////////////////////////////////////////
+      //
+      // parse the adaptor ini, and extract all information into a map hierarchy
+      //
+      void get_ini (saga::ini::ini const adap_ini);
   };
   //
   ///////////////////////////////////////////////////////////////////////////
@@ -75,7 +82,9 @@
       std::string check_type    (void);
 
       bool initialized_;
+
       std::map <std::string, std::string> ini_;
+      std::map <std::string, std::string> env_;
 
 
     public:    

Directory: /trunk/adaptors/aws/aws_job/
=======================================

File [modified]: Makefile
Delta lines: +0 -1
===================================================================
--- trunk/adaptors/aws/aws_job/Makefile	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_job/Makefile	2009-01-10 17:07:03 UTC (rev 3253)
@@ -8,7 +8,6 @@
 
 SAGA_SRC          = $(wildcard *.cpp)
 SAGA_OBJ          = $(SAGA_SRC:%.cpp=%.o)
-SAGA_OBJ         += ../internal/aws_helper.o
 
 SAGA_ADAPTOR_TYPE = job
 SAGA_ADAPTOR_NAME = aws_job

File [modified]: aws_job.cpp
Delta lines: +42 -26
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job.cpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_job/aws_job.cpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -27,7 +27,6 @@
 #include "aws_job_istream.hpp"
 #include "aws_job_ostream.hpp"
 
-#include "../internal/aws_helper.hpp"
 
 ////////////////////////////////////////////////////////////////////////
 namespace aws_job
@@ -51,9 +50,9 @@
     std::string type;
     bool        ok = false;
 
-    std::vector <std::string> types = aws_detail::split (adata->ini_["defaults"]["cloud_names"], ' ');
+    std::vector <std::string> types = saga::adaptors::utils::split (adata->ini_["defaults"]["cloud_names"], ' ');
 
-    std::list <saga::context> contexts = p->get_session ().list_contexts ();
+    std::vector <saga::context> contexts = p->get_session ().list_contexts ();
 
     for ( unsigned int i = 0; i < types.size () && ! ok; i++ )
     {
@@ -66,7 +65,7 @@
         // check if we have a context for that type
         std::cout << " == matching scheme " << scheme << "\n";
 
-        std::list <saga::context> :: iterator it;
+        std::vector <saga::context> :: iterator it;
 
         for ( it = contexts.begin (); ! ok && it != contexts.end () ; it++ )
         {
@@ -84,6 +83,13 @@
       }
     }
 
+    env_["JAVA_HOME"]       = ini_["java_home"];
+    env_["EC2_HOME"]        = ini_["ec2_home"];
+    env_["EC2_GSG_KEY"]     = ini_["ec2_proxy"];
+    env_["EC2_PRIVATE_KEY"] = ini_["ec2_key"];
+    env_["EC2_CERT"]        = ini_["ec2_cert"];
+    env_["EC2_URL"]         = ini_["ec2_url"];
+
     // FIXME: more jd checks needed
 
     jd_ = idata->jd_;
@@ -178,9 +184,6 @@
 
     SAGA_LOG_ALWAYS("job.run");
 
-    std::vector <std::string> args;
-    std::vector <std::string> out;
-
     adaptor_data adata (this);
     std::string vm_ip = rm_.get_host ();
     std::string vm_id = rm_.get_path ();
@@ -192,9 +195,11 @@
     std::string exe = jd_.get_attribute (sja::description_executable);
     saga::url   exe_url (exe);
 
+    // we allow staging of execs, if an explicit source host is given
     if ( ! exe_url.get_host ().empty () )
     { 
       // at the moment, only staging from localhost is supported
+      // FIXME: should use ssh file adaptor for simple copy
       if ( ! ( exe_url.get_scheme ().empty ()  ) &&
            ! ( exe_url.get_scheme () == "any"  ) &&
            ! ( exe_url.get_scheme () == "file" ) )
@@ -203,46 +208,57 @@
       }
 
       // the new exe path is created from "/tmp/" + last url path element
-      exe = std::string ("/tmp/") + aws_detail::split (exe_url.get_path (), '/').back ();
+      exe = std::string ("/tmp/") + saga::adaptors::utils::split (exe_url.get_path (), '/').back ();
 
       // stage the executable from the given URL to the new exe location on the
       // remote host
-      args.clear ();
-      args.push_back ("-q"); // quiet
-      args.push_back ("-o"); 
-      args.push_back ("StrictHostKeyChecking=no");
-      args.push_back ("-i");
-      args.push_back (ini_["ec2_proxy"]);
-      args.push_back (exe_url.get_path ());
-      args.push_back ("root@" + vm_ip + ":" + exe);
+      saga::adaptors::utils::process proc ("/usr/bin/scp", env_);
 
-      out = aws_detail::run_process ("/usr/bin/scp", args, ini_);
+      proc.add_arg ("-q"); // quiet
+      proc.add_args ("-o", "StrictHostKeyChecking=no");
+      proc.add_args ("-i", ini_["ec2_proxy"]);
+
+      proc.add_arg (exe_url.get_path ());
+      proc.add_arg ("root@" + vm_ip + ":" + exe);
+
+      (void) proc.run_sync ();
+
+      if ( proc.fail () )
+      {
+        SAGA_ADAPTOR_THROW ("Could not stage Executable", saga::BadParameter);
+      }
     }
 
     SAGA_LOG_ALWAYS("job.run after staging");
 
 
-    args.clear ();
-    args.push_back ("-o");
-    args.push_back ("StrictHostKeyChecking=no");
-    args.push_back ("-i");
-    args.push_back (ini_["ec2_proxy"]);
-    args.push_back ("root@" + vm_ip);
-    args.push_back (exe);
+    saga::adaptors::utils::process proc ("/usr/bin/ssh", env_);
 
+    proc.add_args ("-o", "StrictHostKeyChecking=no");
+    proc.add_args ("-i", ini_["ec2_proxy"]);
+
+    proc.add_arg ("root@" + vm_ip);
+    proc.add_arg (exe);
+
     if ( jd_.attribute_exists (sja::description_arguments) )
     {
       std::vector <std::string> cl_args = jd_.get_vector_attribute (sja::description_arguments);
 
       for ( unsigned int i = 0; i < cl_args.size (); i++ )
       {
-        args.push_back (cl_args[i]);
+        proc.add_arg (cl_args[i]);
       }
     }
 
 
-    out = aws_detail::run_process ("/usr/bin/ssh", args, ini_);
+    // fixme: this should better be done by the ssh job adaptor
+    std::vector <std::string> out = proc.run_sync ();
 
+    if ( proc.fail () )
+    {
+      SAGA_ADAPTOR_THROW ("Could not run Executable", saga::BadParameter);
+    }
+
     for ( unsigned int j = 0; j < out.size (); j++ )
     {
       std::cout << "  output[" << j << "] : " << out[j] << std::endl;

File [modified]: aws_job.hpp
Delta lines: +1 -1
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job.hpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_job/aws_job.hpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -46,8 +46,8 @@
       std::string            id_;
 
       std::map <std::string, std::string> ini_;
+      std::map <std::string, std::string> env_;
 
-
     public:
       // constructor of the job adaptor
       job_cpi_impl  (proxy                           * p, 

File [modified]: aws_job_adaptor.cpp
Delta lines: +76 -1
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job_adaptor.cpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_job/aws_job_adaptor.cpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -49,13 +49,14 @@
     return (list);
   }
 
+
   bool adaptor::init (saga::impl::session  * s,
                       saga::ini::ini const & glob_ini, 
                       saga::ini::ini const & adap_ini)
   {
     try 
     {
-      ini_ = aws_detail::get_ini (adap_ini);
+      get_ini (adap_ini);
     }
     catch ( const saga::exception & e )
     {
@@ -66,6 +67,80 @@
     return true;
   }
 
+
+  ///////////////////////////////////////////////////////////////////////////////
+  //
+  // parse the adaptor ini, and extract all information into a map hierarchy
+  //
+  void adaptor::get_ini (saga::ini::ini const adap_ini)
+  {
+    if ( ! adap_ini.has_entry ("cloud_names" ) ||
+         ! adap_ini.has_entry ("ec2_keystore") || 
+         ! adap_ini.has_entry ("java_home"   ) ||
+         ! adap_ini.has_entry ("ec2_home"    ) )
+    {
+      SAGA_ADAPTOR_THROW_NO_CONTEXT ("Adaptor needs the 'cloud_names' key.",
+                                     saga::NoSuccess);
+    }
+
+    std::map <std::string, std::string> defaults = adap_ini.get_entries ();
+
+    ini_["defaults"] = defaults;
+
+
+    // on default, don't keep VMs alive
+    if ( ! adap_ini.has_entry ("ec2_keepalive" ) )
+    {
+      ini_["defaults"]["ec2_keepalive"] = "false";
+    }
+
+
+    std::vector <std::string> cloud_names = saga::adaptors::utils::split (ini_["defaults"]["cloud_names"], ' ');
+
+    for ( unsigned int i = 0; i < cloud_names.size (); i++ )
+    {
+      std::string name = cloud_names[i];
+
+      if ( ! adap_ini.has_section (name) )
+      {
+        SAGA_ADAPTOR_THROW_NO_CONTEXT ((std::string ("Adaptor needs preferences to be set."
+                                                     " for that cloud type: ") + name).c_str (),
+                                       saga::NoSuccess);
+      }
+
+      saga::ini::ini sub_prefs = adap_ini.get_section (name);
+
+      if ( ! sub_prefs.has_entry ("ec2_type"        ) ||
+           ! sub_prefs.has_entry ("ec2_proxy"       ) ||
+           ! sub_prefs.has_entry ("ec2_key"         ) ||
+           ! sub_prefs.has_entry ("ec2_cert"        ) ||
+           ! sub_prefs.has_entry ("ec2_url"         ) ||
+           ! sub_prefs.has_entry ("ec2_keypair_name") ||
+           ! sub_prefs.has_entry ("ec2_keypair"     ) ||
+           ! sub_prefs.has_entry ("ec2_instance"    ) )
+      {
+        SAGA_ADAPTOR_THROW_NO_CONTEXT ((std::string ("Settings incomplete for cloud type ") + name).c_str (),
+                                       saga::NoSuccess);
+      }
+
+
+      ini_[name]["cloud_names"  ] = ini_["defaults"]["cloud_names"  ];
+      ini_[name]["ec2_keystore" ] = ini_["defaults"]["ec2_keystore" ];
+      ini_[name]["java_home"    ] = ini_["defaults"]["java_home"    ];
+      ini_[name]["ec2_home"     ] = ini_["defaults"]["ec2_home"     ];
+      ini_[name]["ec2_keepalive"] = ini_["defaults"]["ec2_keepalive"];
+
+      
+      std::map <std::string, std::string> settings = sub_prefs.get_entries ();
+      std::map <std::string, std::string> :: iterator it;
+
+      for ( it = settings.begin (); it != settings.end (); it++ )
+      {
+        ini_[name][(*it).first] = (*it).second;
+      }
+    }
+  }
+
 } // namespace aws_job
 ////////////////////////////////////////////////////////////////////////
 

File [modified]: aws_job_adaptor.hpp
Delta lines: +8 -3
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job_adaptor.hpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_job/aws_job_adaptor.hpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -10,7 +10,6 @@
 
 // saga adaptor includes
 #include <saga/saga/adaptors/adaptor.hpp>
-#include "../internal/aws_helper.hpp"
 
 ////////////////////////////////////////////////////////////////////////
 namespace aws_job
@@ -18,12 +17,12 @@
   class adaptor : public saga::adaptor
   {
     public:
-      aws_detail::aws_ini_map_t ini_;
-
       typedef saga::impl::v1_0::op_info         op_info;  
       typedef saga::impl::v1_0::cpi_info        cpi_info;
       typedef saga::impl::v1_0::preference_type preference_type;
 
+      std::map <std::string, std::map <std::string, std::string> > ini_;
+
       // This function registers the adaptor with the factory
       // @param factory the factory where the adaptor registers
       //        its maker function and description table
@@ -38,6 +37,12 @@
       { 
         return BOOST_PP_STRINGIZE (SAGA_ADAPTOR_NAME);
       }
+
+      ///////////////////////////////////////////////////////////////////////////////
+      //
+      // parse the adaptor ini, and extract all information into a map hierarchy
+      //
+      void get_ini (saga::ini::ini const adap_ini);
   };
 
 } // namespace aws_job

File [modified]: aws_job_service.cpp
Delta lines: +140 -163
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job_service.cpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_job/aws_job_service.cpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -24,7 +24,6 @@
 #include <saga/saga/packages/job/adaptors/job_self.hpp>
 
 // adaptor includes
-#include "../internal/aws_helper.hpp"
 #include "aws_job_service.hpp"
 
 
@@ -49,9 +48,9 @@
     std::string type;
     bool        ok = false;
 
-    std::vector <std::string> types = aws_detail::split (adata->ini_["defaults"]["cloud_names"], ' ');
+    std::vector <std::string> types = saga::adaptors::utils::split (adata->ini_["defaults"]["cloud_names"], ' ');
 
-    std::list <saga::context> contexts = p->get_session ().list_contexts ();
+    std::vector <saga::context> contexts = p->get_session ().list_contexts ();
 
     for ( unsigned int i = 0; i < types.size () && ! ok; i++ )
     {
@@ -63,7 +62,7 @@
         // check if we have a context for that type
         std::cout << " == matching scheme " << scheme << "\n";
 
-        std::list <saga::context> :: iterator it;
+        std::vector <saga::context> :: iterator it;
 
         for ( it = contexts.begin (); ! ok && it != contexts.end () ; it++ )
         {
@@ -90,30 +89,33 @@
                                      saga::BadParameter);
     }
 
+    env_["JAVA_HOME"]       = ini_["java_home"];
+    env_["EC2_HOME"]        = ini_["ec2_home"];
+    env_["EC2_GSG_KEY"]     = ini_["ec2_proxy"];
+    env_["EC2_PRIVATE_KEY"] = ini_["ec2_key"];
+    env_["EC2_CERT"]        = ini_["ec2_cert"];
+    env_["EC2_URL"]         = ini_["ec2_url"];
+    
+    saga::adaptors::utils::process proc (env_);
 
-    std::string state;
-
-
     // is a VM given which we should contact?
     if ( idata->rm_.get_host () == "" )
     {
       // no host - create a new VM instance to submit jobs to.
-      std::vector <std::string> args;
-      std::vector <std::string> out;
-      std::vector <std::string> out_words;
 
-      args.push_back ("-k");
-      args.push_back (ini_["ec2_keypair_name"]);
-      args.push_back (ini_["ec2_instance"]);
+      proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-run-instances");
+
+      proc.add_args ("-k", ini_["ec2_keypair_name"]);
+      proc.add_arg  (ini_["ec2_instance"]);
       
-      out = aws_detail::run_process (ini_["ec2_home"] + "/bin/ec2-run-instances", args, ini_);
+      std::vector <std::string> out = proc.run_sync ();
 
       if ( out.size() < 1 )
       {
         SAGA_ADAPTOR_THROW ("could not start new VM instance", saga::NoSuccess);
       }
 
-      out_words = aws_detail::split (out[out.size () - 1]);
+      std::vector <std::string> out_words = saga::adaptors::utils::split (out[out.size () - 1]);
 
       if ( out_words.size() < 6 )
       {
@@ -122,23 +124,28 @@
 
       vm_ip_ = "";
       vm_id_ = out_words[1];
-      state  = out_words[5];
 
-      args.clear ();
-      args.push_back (vm_id_);
+      std::string state = out_words[5];
 
+
+
+      proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-describe-instances");
+      
+      proc.clear_args ();
+      proc.add_arg (vm_id_);
+
       while ( state == "pending" )
       {
         ::sleep (1);
 
-        out = aws_detail::run_process (ini_["ec2_home"] + "/bin/ec2-describe-instances", args, ini_);
+        out = proc.run_sync ();
 
         if ( out.size() < 1 )
         {
           SAGA_ADAPTOR_THROW ("could not check vm state", saga::NoSuccess);
         }
 
-        out_words = aws_detail::split (out[out.size () - 1]);
+        out_words = saga::adaptors::utils::split (out[out.size () - 1]);
 
         if ( out_words.size() < 6 )
         {
@@ -146,13 +153,12 @@
         }
 
         state = out_words[5];
+        std::cout << state << std::endl;
       }
 
+
       vm_ip_ = out_words[3];
-      state  = out_words[5];
 
-      std::cout << state << std::endl;
-
       if ( state != "running" )
       {
         SAGA_ADAPTOR_THROW ("Cannot run vm instance", saga::NoSuccess);
@@ -164,31 +170,39 @@
       idata->rm_.set_host (      vm_ip_);
       idata->rm_.set_path ("/" + vm_id_);
 
-      std::cout << "ip: " << idata->rm_ << " === " << std::endl;
+      std::cout << "rm: " << idata->rm_ << " === " << std::endl;
 
       // need some time for ssh to fire up
+      int count = 0;
       while ( true )
       {
-        try 
-        {
-          std::cout << "trying ssh" << std::endl;
-          args.clear ();
-          args.push_back ("-o");
-          args.push_back ("StrictHostKeyChecking=no");
-          args.push_back ("-i");
-          args.push_back (ini_["ec2_proxy"]);
-          args.push_back ("root@" + vm_ip_);
-          args.push_back ("/bin/true");
+        std::cout << "trying ssh" << std::endl;
 
-          (void) aws_detail::run_process ("/usr/bin/ssh", args, ini_);
+        proc.set_cmd ("/usr/bin/ssh");
 
+        proc.clear_args ();
+
+        proc.add_args ("-o", "StrictHostKeyChecking=no");
+        proc.add_args ("-i", ini_["ec2_proxy"]);
+        proc.add_arg ("root@" + vm_ip_);
+        proc.add_arg ("/bin/true");
+
+        (void) proc.run_sync ();
+
+        if ( proc.done () )
+        {
           break;
         }
-        catch ( ... )
+        else
         {
           std::cout << "trying ssh failed" << std::endl;
           ::sleep (1);
         }
+
+        if ( count++ > 100 )
+        {
+          SAGA_ADAPTOR_THROW ("image could not provide ssh access", saga::NoSuccess);
+        }
       }
 
       std::cout << "trying ssh ok" << std::endl;
@@ -200,36 +214,38 @@
       }
       else
       {
-        try 
-        {
-          std::cout << "preparing image" << std::endl;
+        std::cout << "preparing image" << std::endl;
 
-          // stage the prep script to the VM
-          args.clear ();
-          args.push_back ("-o");
-          args.push_back ("StrictHostKeyChecking=no");
-          args.push_back ("-i");
-          args.push_back (ini_["ec2_proxy"]);
-          args.push_back (ini_["ec2_image_prep"]);
-          args.push_back ("root@" + vm_ip_ + ":/tmp/saga-ec2-image-prep");
+        // stage the prep script to the VM
+        proc.set_cmd ("/usr/bin/scp");
 
-          (void) aws_detail::run_process ("/usr/bin/scp", args, ini_);
+        proc.clear_args ();
+        proc.add_args ("-o", "StrictHostKeyChecking=no");
+        proc.add_args ("-i", ini_["ec2_proxy"]);
+        proc.add_arg  (ini_["ec2_image_prep"]);
+        proc.add_arg  ("root@" + vm_ip_ + ":/tmp/saga-ec2-image-prep");
 
-          // run the prep script
-          args.clear ();
-          args.push_back ("-o");
-          args.push_back ("StrictHostKeyChecking=no");
-          args.push_back ("-i");
-          args.push_back (ini_["ec2_proxy"]);
-          args.push_back ("root@" + vm_ip_);
-          args.push_back ("/tmp/saga-ec2-image-prep");
+        proc.run_sync ();
 
-          (void) aws_detail::run_process ("/usr/bin/ssh", args, ini_);
+        if ( proc.fail () )
+        {
+          SAGA_ADAPTOR_THROW ("image prep-staging failed", saga::NoSuccess);
         }
-        catch ( ... )
+
+        // run the prep script
+        proc.set_cmd ("/usr/bin/ssh");
+
+        proc.clear_args ();
+        proc.add_args ("-o", "StrictHostKeyChecking=no");
+        proc.add_args ("-i", ini_["ec2_proxy"]);
+        proc.add_arg  ("root@" + vm_ip_);
+        proc.add_arg  ("/tmp/saga-ec2-image-prep");
+
+        proc.run_sync ();
+
+        if ( proc.fail () )
         {
-          std::cout << "trying ssh failed" << std::endl;
-          ::sleep (1);
+          SAGA_ADAPTOR_THROW ("image preparation failed", saga::NoSuccess);
         }
       }
     } 
@@ -249,20 +265,19 @@
 
         std::string vm_id_ = host;
 
-        std::vector <std::string> args;
-        std::vector <std::string> out;
-        std::vector <std::string> out_words;
 
-        args.push_back (vm_id_);
+        proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-describe-instances");
+        proc.clear_args ();
+        proc.add_arg (vm_id_);
 
-        out       = aws_detail::run_process (ini_["ec2_home"] + "/bin/ec2-describe-instances", args, ini_);
-        
-        if ( out.size() < 1 )
+        std::vector <std::string> out = proc.run_sync ();
+
+        if ( proc.fail () || out.size() < 1 )
         {
           SAGA_ADAPTOR_THROW ("contact does not point to a running VM instance", saga::BadParameter);
         }
 
-        out_words = aws_detail::split (out[out.size () - 1]);
+        std::vector <std::string> out_words = saga::adaptors::utils::split (out[out.size () - 1]);
 
         if ( out_words.size() < 6 )
         {
@@ -270,8 +285,9 @@
         }
 
         vm_ip_ = out_words[3];
-        state  = out_words[5];
 
+        std::string state  = out_words[5];
+
         std::cout << "id: " << vm_id_ << std::endl;
         std::cout << "ip: " << vm_ip_ << std::endl;
         std::cout << "st: " << state  << std::endl;
@@ -294,37 +310,27 @@
 
         std::string vm_ip_ = host;
 
-        std::vector <std::string> args;
-        std::vector <std::string> out;
-        std::vector <std::string> out_words;
 
-        out = aws_detail::run_process (ini_["ec2_home"] + "/bin/ec2-describe-instances", args, ini_);
+        proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-describe-instances");
 
-        if ( out.size() < 1 )
+        std::vector <std::string> out = proc.run_sync ();
+
+        if ( proc.fail () || out.size() < 1 )
         {
           SAGA_ADAPTOR_THROW ("contact does not point to a running VM instance", saga::BadParameter);
         }
 
         // find the line which contains the hostname
-        std::string match ("");
+        out = saga::adaptors::utils::grep (host, out);
 
-        for ( unsigned int i = 0; i < out.size (); i++ )
+        if ( out.size () != 1 )
         {
-          if ( out[i].find (host) != std::string::npos )
-          {
-            match = out[i];
-            break;
-          }
-        }
-
-        if ( match == "" )
-        {
           SAGA_ADAPTOR_THROW ("contact does not point to a running VM instance", saga::NoSuccess);
         }
 
-        SAGA_LOG_ALWAYS (match.c_str ());
+        SAGA_LOG_ALWAYS (out[0].c_str ());
 
-        out_words = aws_detail::split (match);
+        std::vector <std::string> out_words = saga::adaptors::utils::split (out[0]);
 
         if ( out_words.size() < 6 )
         {
@@ -332,8 +338,9 @@
         }
 
         vm_id_ = out_words[1];
-        state  = out_words[5];
 
+        std::string state  = out_words[5];
+
         std::cout << "id: " << vm_id_ << std::endl;
         std::cout << "ip: " << vm_ip_ << std::endl;
         std::cout << "st: " << state  << std::endl;
@@ -357,30 +364,31 @@
 
     std::cout << "  rm: " << idata->rm_ << std::endl;
 
+
     // we do have a job service instance, either new started or old and running.
     // Now, copy over the ssh identity file of the context we used, so that jobs
     // running on that instance can use it to contact other instances using the
     // same context.  Note that we do _not_ copy the identity files of other
     // contexts, as we don't want to spread credentials beyond their respective
     // universe.
-    try 
-    {
-      std::cout << "copying identity file" << std::endl;
 
-      std::vector <std::string> args;
+    std::cout << "copying identity file" << std::endl;
 
-      args.push_back ("-o");
-      args.push_back ("StrictHostKeyChecking=no");
-      args.push_back ("-i");
-      args.push_back (ini_["ec2_proxy"]);  // identity to use ==
-      args.push_back (ini_["ec2_proxy"]);  // == file to stage
+    proc.set_cmd ("/usr/bin/scp");
 
-      // FIXME: the target below SHOULD not exist *aehem*
-      args.push_back ("root@" + vm_ip_ + ":.ssh/id_rsa");
+    proc.clear_args ();
+    proc.add_args ("-o", "StrictHostKeyChecking=no");
+    proc.add_args ("-i", ini_["ec2_proxy"]);
 
-      (void) aws_detail::run_process ("/usr/bin/scp", args, ini_);
-    }
-    catch ( ... )
+    // == file to stage
+    proc.add_arg (ini_["ec2_proxy"]);  
+
+    // FIXME: the target below SHOULD not exist *aehem*
+    proc.add_arg ("root@" + vm_ip_ + ":.ssh/id_rsa");
+
+    (void) proc.run_sync ();
+
+    if ( proc.fail () )
     {
       std::cout << "could not copy ssh key" << std::endl;
       throw;
@@ -391,67 +399,37 @@
     // we also propagate our HOME/.saga.ini file.  This is kind of a hack
     // (FIXME), but allows us to have a uniform SAGA configuration for all VMs.
     // FIXME: that should be better done with the prep scripts above.
-    try 
-    {
-      std::cout << "copying ~/.saga.ini" << std::endl;
+    
+    std::cout << "copying ~/.saga.ini" << std::endl;
 
-      std::vector <std::string> args;
+    proc.set_cmd ("/usr/bin/scp");
+    proc.clear_args ();
 
-      args.push_back ("-o");
-      args.push_back ("StrictHostKeyChecking=no");
-      args.push_back ("-i");
-      args.push_back (ini_["ec2_proxy"]);
+    proc.add_args ("-o", "StrictHostKeyChecking=no");
+    proc.add_args ("-i", ini_["ec2_proxy"]);
 
-      char * home = ::getenv ("HOME");
-      if ( home != NULL )
-      {
-        std::string home_s (home);
-        args.push_back (home_s + "/.saga.ini");
-      }
-      else
-      {
-        args.push_back (".saga.ini");
-      }
+    char * home = ::getenv ("HOME");
 
-      // FIXME: the target below SHOULD not exist *aehem*
-      args.push_back ("root@" + vm_ip_ + ":.saga.ini");
-
-      (void) aws_detail::run_process ("/usr/bin/scp", args, ini_);
+    if ( home != NULL )
+    {
+      std::string home_s (home);
+      proc.add_arg (home_s + "/.saga.ini");
     }
-    catch ( ... )
+    else
     {
-      std::cout << "could not copy saga.ini" << std::endl;
-      throw;
+      proc.add_arg (".saga.ini");
     }
 
+    // FIXME: the target below SHOULD not exist *aehem*
+    proc.add_arg ("root@" + vm_ip_ + ":.saga.ini");
 
-    // finally, we deploy the /tmp/saga/ subdirectory to the VM, and expect our
-    // applications to live therein.  
-    // FIXME: that should be better done with the prep scripts above.
-    try 
+    (void) proc.run_sync ();
+    
+    if ( proc.fail () )
     {
-      std::cout << "copying /tmp/saga" << std::endl;
-
-      std::vector <std::string> args;
-
-      args.push_back ("-o");
-      args.push_back ("StrictHostKeyChecking=no");
-      args.push_back ("-i");
-      args.push_back (ini_["ec2_proxy"]);
-      args.push_back ("-r"); 
-      args.push_back ("/tmp/saga");
-
-      // FIXME: the target SHOULD not exist *aehem*
-      args.push_back ("root@" + vm_ip_ + ":/tmp/");
-
-      (void) aws_detail::run_process ("/usr/bin/scp", args, ini_);
-    }
-    catch ( ... )
-    {
       std::cout << "could not copy saga.ini" << std::endl;
       throw;
     }
-
   }
 
   //////////////////////////////////////////////////////////////////////
@@ -467,7 +445,8 @@
     // FIXME: for now, we simply shut down the instance, if ec2_keepalive is not
     // set to false, to avoid overly large bills for my credit card :o)
 
-    if ( ini_["ec2_keepalive"] == "true" )
+    if ( ini_["ec2_keepalive"] == "yes"  ||
+         ini_["ec2_keepalive"] == "true" )
     {
       SAGA_LOG_ALWAYS ("ec2_keepalive: true"); 
     }
@@ -475,24 +454,22 @@
     {
       SAGA_LOG_ALWAYS ("ec2_keepalive: !true"); 
 
-      std::vector <std::string> args;
-      args.push_back (vm_id_);
+      std::string msg ("Shut down VM instance ");
+      msg += vm_id_;
+      SAGA_LOG_ALWAYS (msg.c_str ()); 
 
-      try {
-        (void) aws_detail::run_process (ini_["ec2_home"] + "/bin/ec2-terminate-instances", args, ini_);
+      saga::adaptors::utils::process proc (ini_["ec2_home"] + "/bin/ec2-terminate-instances", env_);
+      proc.add_arg (vm_id_);
 
-        std::string msg ("Shut down VM instance ");
-        msg += vm_id_;
-        SAGA_LOG_ALWAYS (msg.c_str ()); 
-      }
-      catch ( ... )
+      (void) proc.run_sync ();
+
+      if ( proc.fail () )
       {
         // well, we can't do much in case of errors, other then warn the user
         // that the VM may continue to run
-        std::string msg ("Could not shut down VM instance ");
-        msg += vm_id_;
-        SAGA_LOG_ALWAYS (msg.c_str ()); 
+        SAGA_LOG_CRITICAL ("Could not shut down VM instance ");
       }
+      
     }
   }
 

File [modified]: aws_job_service.hpp
Delta lines: +4 -1
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job_service.hpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/aws_job/aws_job_service.hpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -48,9 +48,12 @@
       std::string vm_id_;
       std::string vm_ip_;
 
-      std::map <std::string, std::string> ini_;
       saga::context ctx_;   // context used to access this job service
 
+      std::map <std::string, std::string> ini_;
+      std::map <std::string, std::string> env_;
+
+
     public:
       // constructor of the job_service cpi
       job_service_cpi_impl  (proxy                           * p, 

Directory: /trunk/adaptors/aws/external/ec2-api-tools/bin/
==========================================================

File [modified]: Makefile
Delta lines: +1 -1
===================================================================
--- trunk/adaptors/aws/external/ec2-api-tools/bin/Makefile	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/external/ec2-api-tools/bin/Makefile	2009-01-10 17:07:03 UTC (rev 3253)
@@ -7,7 +7,7 @@
 -include ../../../config/make.cfg
 -include $(SAGA_MAKE_INCLUDE_ROOT)/saga.util.mk
 
-SAGA_TOOL_DIR   = aws-tools/
+SAGA_TOOL_DIR   = aws-tools/bin/
 SAGA_TOOLS      = $(wildcard ec2*)
 
 -include $(SAGA_MAKE_INCLUDE_ROOT)/saga.mk

Directory: /trunk/adaptors/aws/internal/
========================================

File [modified]: Makefile
Delta lines: +0 -3
===================================================================
--- trunk/adaptors/aws/internal/Makefile	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/internal/Makefile	2009-01-10 17:07:03 UTC (rev 3253)
@@ -4,9 +4,6 @@
 #  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 #  http://www.boost.org/LICENSE_1_0.txt)
 
-SAGA_SRC = aws_helper.cpp
-SAGA_OBJ = aws_helper.o
-
 SAGA_SUBDIRS = bin
 
 -include ../config/make.cfg

File [removed]: aws_helper.cpp
Delta lines: +0 -209
===================================================================
--- trunk/adaptors/aws/internal/aws_helper.cpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/internal/aws_helper.cpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -1,209 +0,0 @@
-
-
-#include <iostream>
-#include <fstream>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <boost/process.hpp>
-
-// private include
-#include "aws_helper.hpp"
-
-// for the throw macro...
-#include <saga/saga/adaptors/adaptor.hpp>
-
-
-namespace aws_detail 
-{
-  ///////////////////////////////////////////////////////////////////////////////
-  //
-  // run a process, and return stdout.  In case of errors, throw a NoSuccess with
-  // stderr as error message
-  //
-  std::vector <std::string> run_process (std::string                         path, 
-                                         std::vector <std::string>           args, 
-                                         std::map <std::string, std::string> env)
-  {
-    boost::process::command_line cl (path);
-
-    std::cout << "  >> (" << env["ec2_type"] << ") " << path;
-
-    for ( unsigned int i = 0; i < args.size (); i++ )
-    {
-      cl.argument (args[i]);
-      std::cout << " " << args[i];
-    }
-
-    std::cout << std::endl;
-
-    boost::process::launcher l;
-
-    l.set_stdin_behavior  (boost::process::redirect_stream);
-    l.set_stdout_behavior (boost::process::redirect_stream);
-    l.set_stderr_behavior (boost::process::redirect_stream);
-
-    l.set_environment ("JAVA_HOME",       env["java_home"]);
-    l.set_environment ("EC2_HOME",        env["ec2_home"]);
-    l.set_environment ("EC2_GSG_KEY",     env["ec2_proxy"]);
-    l.set_environment ("EC2_PRIVATE_KEY", env["ec2_key"]);
-    l.set_environment ("EC2_CERT",        env["ec2_cert"]);
-    l.set_environment ("EC2_URL",         env["ec2_url"]);
-
-    // std::cout << "JAVA_HOME        : " << env["java_home"] << "\n";
-    // std::cout << "EC2_HOME         : " << env["ec2_home"]  << "\n";
-    // std::cout << "EC2_GSG_KEY      : " << env["ec2_proxy"] << "\n";
-    // std::cout << "EC2_PRIVATE_KEY  : " << env["ec2_key"]   << "\n";
-    // std::cout << "EC2_CERT         : " << env["ec2_cert"]  << "\n";
-    // std::cout << "EC2_URL          : " << env["ec2_url"]   << "\n";
-
-
-    boost::process::child c = l.start (cl);
-
-    boost::process::pistream & out = c.get_stdout ();
-    boost::process::pistream & err = c.get_stderr ();
-
-
-    std::vector <std::string> output;
-    std::string               error;
-
-    for ( std::string line; getline (out, line); output.push_back  (line) );
-    for ( std::string line; getline (err, line); error  += "\n  " + line );
-
-
-    boost::process::status status = c.wait();
-
-    if ( ! status.exited () || status.exit_status () )
-    {
-      SAGA_ADAPTOR_THROW_NO_CONTEXT ("Failed to run " + path + ": " + error,
-                                     saga::NoSuccess);
-    }
-
-    return output;
-  }
-  ///////////////////////////////////////////////////////////////////////////////
-
-  ///////////////////////////////////////////////////////////////////////////////
-  //
-  // This should be replaced by something like get_instance_id() etc, which
-  // actually looks at the field values (i-*, r-* ...)
-  //
-  std::vector <std::string> split (std::string line,
-                                   char        delim)
-  {
-    std::vector <std::string> list;
-    std::string               elem;
-
-    for ( unsigned int i = 0; i < line.length (); i++ )
-    {
-      char c = line[i];
-
-      if ( c == delim )
-      {
-        // store element if there is any content (even if element is empty)
-        list.push_back (elem);
-        elem = "";
-      }
-      else
-      {
-        // save any char which is not the delimiter
-        elem += c;
-      }
-    }
-
-    if ( elem.length () > 0 )
-    {
-      // save any remaining content at EOL
-      list.push_back (elem);
-    }
-
-    // for ( unsigned int j = 0; j < list.size (); j++ )
-    // {
-    //   std::cout << "  [" << j << "]  " << list[j] << std::endl;
-    // }
-
-    return (list);
-  }
-
-  ///////////////////////////////////////////////////////////////////////////////
-  //
-  // parse the adaptor ini, and extract all information into a map hierarchy
-  //
-  typedef std::map <std::string, std::map <std::string, std::string> > aws_ini_map_t;
-
-  aws_ini_map_t get_ini (saga::ini::ini const adap_ini)
-  {
-    aws_ini_map_t ini_;
-
-    if ( ! adap_ini.has_entry ("cloud_names" ) ||
-         ! adap_ini.has_entry ("ec2_keystore") || 
-         ! adap_ini.has_entry ("java_home"   ) ||
-         ! adap_ini.has_entry ("ec2_home"    ) )
-    {
-      SAGA_ADAPTOR_THROW_NO_CONTEXT ("Adaptor needs the 'cloud_names' key.",
-                                     saga::NoSuccess);
-    }
-
-    std::map <std::string, std::string> defaults = adap_ini.get_entries ();
-
-    ini_["defaults"] = defaults;
-
-
-    // on default, don't keep VMs alive
-    if ( ! adap_ini.has_entry ("ec2_keepalive" ) )
-    {
-      ini_["defaults"]["ec2_keepalive"] = "false";
-    }
-
-
-    std::vector <std::string> cloud_names = aws_detail::split (ini_["defaults"]["cloud_names"], ' ');
-
-    for ( unsigned int i = 0; i < cloud_names.size (); i++ )
-    {
-      std::string name = cloud_names[i];
-
-      if ( ! adap_ini.has_section (name) )
-      {
-        SAGA_ADAPTOR_THROW_NO_CONTEXT ((std::string ("Adaptor needs preferences to be set."
-                                                     " for that cloud type: ") + name).c_str (),
-                                       saga::NoSuccess);
-      }
-
-      saga::ini::ini sub_prefs = adap_ini.get_section (name);
-
-      if ( ! sub_prefs.has_entry ("ec2_type"        ) ||
-           ! sub_prefs.has_entry ("ec2_proxy"       ) ||
-           ! sub_prefs.has_entry ("ec2_key"         ) ||
-           ! sub_prefs.has_entry ("ec2_cert"        ) ||
-           ! sub_prefs.has_entry ("ec2_url"         ) ||
-           ! sub_prefs.has_entry ("ec2_keypair_name") ||
-           ! sub_prefs.has_entry ("ec2_keypair"     ) ||
-           ! sub_prefs.has_entry ("ec2_instance"    ) )
-      {
-        SAGA_ADAPTOR_THROW_NO_CONTEXT ((std::string ("Settings incomplete for cloud type ") + name).c_str (),
-                                       saga::NoSuccess);
-      }
-
-
-      ini_[name]["cloud_names"  ] = ini_["defaults"]["cloud_names"  ];
-      ini_[name]["ec2_keystore" ] = ini_["defaults"]["ec2_keystore" ];
-      ini_[name]["java_home"    ] = ini_["defaults"]["java_home"    ];
-      ini_[name]["ec2_home"     ] = ini_["defaults"]["ec2_home"     ];
-      ini_[name]["ec2_keepalive"] = ini_["defaults"]["ec2_keepalive"];
-
-      
-      std::map <std::string, std::string> settings = sub_prefs.get_entries ();
-      std::map <std::string, std::string> :: iterator it;
-
-      for ( it = settings.begin (); it != settings.end (); it++ )
-      {
-        ini_[name][(*it).first] = (*it).second;
-      }
-    }
-
-    return ini_;
-  }
-
-} // namespace aws_detail
-

File [removed]: aws_helper.hpp
Delta lines: +0 -38
===================================================================
--- trunk/adaptors/aws/internal/aws_helper.hpp	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/internal/aws_helper.hpp	2009-01-10 17:07:03 UTC (rev 3253)
@@ -1,38 +0,0 @@
-
-#ifndef AWS_HELPER_HPP
-#define AWS_HELPER_HPP
-
-// for ini handling 
-#include <saga/saga/adaptors/utils/ini/ini.hpp>
-
-namespace aws_detail 
-{
-  ///////////////////////////////////////////////////////////////////////////////
-  //
-  // run a process, and return stdout.  In case of errors, throw a NoSuccess with
-  // stderr as error message
-  //
-  std::vector <std::string> run_process (std::string                         path, 
-                                         std::vector <std::string>           args, 
-                                         std::map <std::string, std::string> env);
-  ///////////////////////////////////////////////////////////////////////////////
-
-  ///////////////////////////////////////////////////////////////////////////////
-  //
-  // split a line at the delimiter
-  //
-  std::vector <std::string> split (std::string line,
-                                   char        delim = '\t');
-
-  ///////////////////////////////////////////////////////////////////////////////
-  //
-  // parse the adaptor ini, and extract all information into a map hierarchy
-  //
-  typedef std::map <std::string, std::map <std::string, std::string> > aws_ini_map_t;
-
-  aws_ini_map_t get_ini  (saga::ini::ini const adap_ini);
-
-} // namespace aws_detail
-
-#endif // AWS_HELPER_HPP
-

Directory: /trunk/adaptors/aws/external/ec2-api-tools/lib/
==========================================================

File [modified]: Makefile
Delta lines: +3 -3
===================================================================
--- trunk/adaptors/aws/external/ec2-api-tools/lib/Makefile	2009-01-09 12:11:51 UTC (rev 3252)
+++ trunk/adaptors/aws/external/ec2-api-tools/lib/Makefile	2009-01-10 17:07:03 UTC (rev 3253)
@@ -7,7 +7,7 @@
 -include ../../../config/make.cfg
 -include $(SAGA_MAKE_INCLUDE_ROOT)/saga.util.mk
 
-SAGA_TOOL_LIBDIR = java/
+SAGA_TOOL_LIBDIR = aws-tools/lib/
 SAGA_TOOL_LIBS   = $(wildcard *.jar)
 
 
@@ -15,6 +15,6 @@
 
 install::
 	 @$(ECHO) "      installing   aws tool libs" 
-	 @$(MKDIR)                           $(SAGA_LIB_ROOT)/$(SAGA_TOOL_LIBDIR)
-	 @$(CP)          $(SAGA_TOOL_LIBS)   $(SAGA_LIB_ROOT)/$(SAGA_TOOL_LIBDIR)
+	 @$(MKDIR)                           $(SAGA_BIN_ROOT)/$(SAGA_TOOL_LIBDIR)
+	 @$(CP)          $(SAGA_TOOL_LIBS)   $(SAGA_BIN_ROOT)/$(SAGA_TOOL_LIBDIR)
 



More information about the saga-devel mailing list