libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1454786 - /libcloud/trunk/libcloud/compute/deployment.py
Date Sun, 10 Mar 2013 04:49:27 GMT
Author: tomaz
Date: Sun Mar 10 04:49:26 2013
New Revision: 1454786

URL: http://svn.apache.org/r1454786
Log:
Modify ScriptDeployment to work correctly if "self.name" contains a relative
path.

Part of LIBCLOUD-278.

Modified:
    libcloud/trunk/libcloud/compute/deployment.py

Modified: libcloud/trunk/libcloud/compute/deployment.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/deployment.py?rev=1454786&r1=1454785&r2=1454786&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/deployment.py (original)
+++ libcloud/trunk/libcloud/compute/deployment.py Sun Mar 10 04:49:26 2013
@@ -149,9 +149,17 @@ class ScriptDeployment(Deployment):
 
         See also L{Deployment.run}
         """
+        file_path = client.put(path=self.name, chmod=int('755', 8),
+                               contents=self.script)
 
-        client.put(path=self.name, chmod=int('755', 8), contents=self.script)
-        self.stdout, self.stderr, self.exit_status = client.run(self.name)
+        # Pre-pend cwd if user specified a relative path
+        if self.name[0] != '/':
+            base_path = os.path.dirname(file_path)
+            name = os.path.join(base_path, self.name)
+        else:
+            name = self.name
+
+        self.stdout, self.stderr, self.exit_status = client.run(name)
 
         if self.delete:
             client.delete(self.name)



Mime
View raw message