libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1471675 - in /libcloud/trunk: CHANGES libcloud/compute/deployment.py libcloud/test/compute/test_deployment.py
Date Wed, 24 Apr 2013 21:03:07 GMT
Author: tomaz
Date: Wed Apr 24 21:03:06 2013
New Revision: 1471675

URL: http://svn.apache.org/r1471675
Log:
Fix Python 3 compatibility issue in the ScriptFileDeployment class.

Part of LIBCLOUD-321, contributed by Arfrever Frehtes Taifersar Arahesis.

Modified:
    libcloud/trunk/CHANGES
    libcloud/trunk/libcloud/compute/deployment.py
    libcloud/trunk/libcloud/test/compute/test_deployment.py

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1471675&r1=1471674&r2=1471675&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Wed Apr 24 21:03:06 2013
@@ -10,6 +10,10 @@ Changes with Apache Libcloud in deveplom
     - Add ex_start_node method to the Joyent driver. (LIBCLOUD-319)
       [rszabo50]
 
+    - Fix Python 3 compatibility issue in the ScriptFileDeployment class.
+      (LIBCLOUD-321)
+      [Arfrever Frehtes Taifersar Arahesis]
+
  *) Load Balancer
 
     - Add ex_list_current_usage method to the Rackspace driver.

Modified: libcloud/trunk/libcloud/compute/deployment.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/deployment.py?rev=1471675&r1=1471674&r2=1471675&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/deployment.py (original)
+++ libcloud/trunk/libcloud/compute/deployment.py Wed Apr 24 21:03:06 2013
@@ -22,7 +22,7 @@ from __future__ import with_statement
 import os
 import binascii
 
-from libcloud.utils.py3 import basestring
+from libcloud.utils.py3 import basestring, PY3
 
 
 class Deployment(object):
@@ -188,6 +188,9 @@ class ScriptFileDeployment(ScriptDeploym
         with open(script_file, 'rb') as fp:
             content = fp.read()
 
+        if PY3:
+            content = content.decode('utf-8')
+
         super(ScriptFileDeployment, self).__init__(script=content,
                                                name=name,
                                                delete=delete)

Modified: libcloud/trunk/libcloud/test/compute/test_deployment.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/test/compute/test_deployment.py?rev=1471675&r1=1471674&r2=1471675&view=diff
==============================================================================
--- libcloud/trunk/libcloud/test/compute/test_deployment.py (original)
+++ libcloud/trunk/libcloud/test/compute/test_deployment.py Wed Apr 24 21:03:06 2013
@@ -23,7 +23,7 @@ import unittest
 
 from libcloud.utils.py3 import httplib
 from libcloud.utils.py3 import u
-from libcloud.utils.py3 import PY32
+from libcloud.utils.py3 import PY3
 
 from libcloud.compute.deployment import MultiStepDeployment, Deployment
 from libcloud.compute.deployment import SSHKeyDeployment, ScriptDeployment
@@ -115,14 +115,13 @@ class DeploymentTests(unittest.TestCase)
                         client=MockClient(hostname='localhost')))
 
     def test_script_file_deployment(self):
-        # TODO: Fix 3.2 compatibility
-        if PY32:
-            return
-
         file_path = os.path.abspath(__file__)
         with open(file_path, 'rb') as fp:
             content = fp.read()
 
+        if PY3:
+            content = content.decode('utf-8')
+
         sfd1 = ScriptFileDeployment(script_file=file_path)
         self.assertEqual(sfd1.script, content)
 



Mime
View raw message