libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1453708 - in /libcloud/branches/0.12.x: ./ CHANGES libcloud/compute/deployment.py libcloud/compute/ssh.py
Date Thu, 07 Mar 2013 06:36:42 GMT
Author: tomaz
Date: Thu Mar  7 06:36:41 2013
New Revision: 1453708

URL: http://svn.apache.org/r1453708
Log:
Backport commit r1453705 from trunk.

Modified:
    libcloud/branches/0.12.x/   (props changed)
    libcloud/branches/0.12.x/CHANGES
    libcloud/branches/0.12.x/libcloud/compute/deployment.py
    libcloud/branches/0.12.x/libcloud/compute/ssh.py

Propchange: libcloud/branches/0.12.x/
------------------------------------------------------------------------------
  Merged /libcloud/trunk:r1453705

Modified: libcloud/branches/0.12.x/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/CHANGES?rev=1453708&r1=1453707&r2=1453708&view=diff
==============================================================================
--- libcloud/branches/0.12.x/CHANGES (original)
+++ libcloud/branches/0.12.x/CHANGES Thu Mar  7 06:36:41 2013
@@ -8,6 +8,16 @@ Changes with Apache Libcloud 0.12.2:
       Reported by Arfrever Frehtes Taifersar Arahesis.
       [Tomaz Muraus]
 
+    - Improve deploy code to work correctly if the ssh user doesn't have access
+      to the /root directory.
+
+      Previously the ScriptDeployment script was stored in /root folder by
+      default. Now it's stored in users home directory under filename
+      ~/libcloud_deploymeny_<random>.sh. (LIBCLOUD-302)
+
+      Reported by rotem on #libcloud.
+      [Tomaz Muraus]
+
   *) Compute
 
     - Improve public and private IP address handling in OpenStack 1.1 driver.

Modified: libcloud/branches/0.12.x/libcloud/compute/deployment.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/deployment.py?rev=1453708&r1=1453707&r2=1453708&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/deployment.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/deployment.py Thu Mar  7 06:36:41 2013
@@ -91,7 +91,7 @@ class FileDeployment(Deployment):
         @keyword source: Local path of file to be installed
 
         @type target: C{str}
-        @keyword target: Path to install file on node 
+        @keyword target: Path to install file on node
         """
         self.source = source
         self.target = target
@@ -137,8 +137,11 @@ class ScriptDeployment(Deployment):
         self.exit_status = None
         self.delete = delete
         self.name = name
+
         if self.name is None:
-            self.name = "/root/deployment_%s.sh" % (binascii.hexlify(os.urandom(4)))
+            # File is put under user's home directory
+            # (~/libcloud_deployment_<random_string>.sh)
+            self.name = 'libcloud_deployment_%s.sh' % (binascii.hexlify(os.urandom(4)))
 
     def run(self, node, client):
         """
@@ -149,8 +152,10 @@ class ScriptDeployment(Deployment):
 
         client.put(path=self.name, chmod=int('755', 8), contents=self.script)
         self.stdout, self.stderr, self.exit_status = client.run(self.name)
+
         if self.delete:
             client.delete(self.name)
+
         return node
 
 

Modified: libcloud/branches/0.12.x/libcloud/compute/ssh.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/ssh.py?rev=1453708&r1=1453707&r2=1453708&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/ssh.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/ssh.py Thu Mar  7 06:36:41 2013
@@ -157,8 +157,13 @@ class ParamikoSSHClient(BaseSSHClient):
         sftp = self.client.open_sftp()
         # less than ideal, but we need to mkdir stuff otherwise file() fails
         head, tail = psplit(path)
+
         if path[0] == "/":
             sftp.chdir("/")
+        else:
+            # Relative path - start from a home directory (~)
+            sftp.chdir('.')
+
         for part in head.split("/"):
             if part != "":
                 try:
@@ -168,6 +173,7 @@ class ParamikoSSHClient(BaseSSHClient):
                     # catch EEXIST consistently *sigh*
                     pass
                 sftp.chdir(part)
+
         ak = sftp.file(tail, mode=mode)
         ak.write(contents)
         if chmod is not None:



Mime
View raw message