You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2014/08/15 16:18:20 UTC

[1/4] git commit: Add enable_user and disable_user method to Identity API v3 class.

Repository: libcloud
Updated Branches:
  refs/heads/trunk 3f8fc51e9 -> 950f972c3


Add enable_user and disable_user method to Identity API v3 class.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7557d7b3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7557d7b3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7557d7b3

Branch: refs/heads/trunk
Commit: 7557d7b332dbef6688ea167fde6cd2997f0e2ffa
Parents: 3f8fc51
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Aug 15 15:52:03 2014 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Aug 15 15:52:03 2014 +0200

----------------------------------------------------------------------
 libcloud/common/openstack_identity.py           | 46 ++++++++++++++++++++
 libcloud/test/common/test_openstack_identity.py | 18 ++++++++
 2 files changed, 64 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7557d7b3/libcloud/common/openstack_identity.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack_identity.py b/libcloud/common/openstack_identity.py
index a3492f1..3363aac 100644
--- a/libcloud/common/openstack_identity.py
+++ b/libcloud/common/openstack_identity.py
@@ -1248,6 +1248,52 @@ class OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection):
         user = self._to_user(data=response.object['user'])
         return user
 
+    def enable_user(self, user):
+        """
+        Enable user account.
+
+        Note: This operation appears to be idempotent.
+
+        :param user: User to enable.
+        :type user: :class:`.OpenStackIdentityUser`
+
+        :return: User account which has been enabled.
+        :rtype: :class:`.OpenStackIdentityUser`
+        """
+        data = {
+            'enabled': True
+        }
+        data = json.dumps({'user': data})
+        response = self.authenticated_request('/v3/users/%s' % (user.id),
+                                              data=data,
+                                              method='PATCH')
+
+        user = self._to_user(data=response.object['user'])
+        return user
+
+    def disable_user(self, user):
+        """
+        Disable user account.
+
+        Note: This operation appears to be idempotent.
+
+        :param user: User to disable.
+        :type user: :class:`.OpenStackIdentityUser`
+
+        :return: User account which has been disabled.
+        :rtype: :class:`.OpenStackIdentityUser`
+        """
+        data = {
+            'enabled': False
+        }
+        data = json.dumps({'user': data})
+        response = self.authenticated_request('/v3/users/%s' % (user.id),
+                                              data=data,
+                                              method='PATCH')
+
+        user = self._to_user(data=response.object['user'])
+        return user
+
     def _to_domains(self, data):
         result = []
         for item in data:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7557d7b3/libcloud/test/common/test_openstack_identity.py
----------------------------------------------------------------------
diff --git a/libcloud/test/common/test_openstack_identity.py b/libcloud/test/common/test_openstack_identity.py
index 1c1320e..9ebd599 100644
--- a/libcloud/test/common/test_openstack_identity.py
+++ b/libcloud/test/common/test_openstack_identity.py
@@ -30,6 +30,7 @@ from libcloud.common.openstack_identity import get_class_for_auth_version
 from libcloud.common.openstack_identity import OpenStackIdentity_2_0_Connection
 from libcloud.common.openstack_identity import OpenStackServiceCatalog
 from libcloud.common.openstack_identity import OpenStackIdentity_3_0_Connection
+from libcloud.common.openstack_identity import OpenStackIdentityUser
 from libcloud.compute.drivers.openstack import OpenStack_1_0_NodeDriver
 
 from libcloud.test import unittest
@@ -342,6 +343,16 @@ class OpenStackIdentity_3_0_ConnectionTests(unittest.TestCase):
         self.assertEqual(user.id, 'c')
         self.assertEqual(user.name, 'test2')
 
+    def test_enable_user(self):
+        user = self.auth_instance.list_users()[0]
+        result = self.auth_instance.enable_user(user=user)
+        self.assertTrue(isinstance(result, OpenStackIdentityUser))
+
+    def test_disable_user(self):
+        user = self.auth_instance.list_users()[0]
+        result = self.auth_instance.disable_user(user=user)
+        self.assertTrue(isinstance(result, OpenStackIdentityUser))
+
     def test_grant_domain_role_to_user(self):
         domain = self.auth_instance.list_domains()[0]
         role = self.auth_instance.list_roles()[0]
@@ -543,6 +554,13 @@ class OpenStackIdentity_3_0_MockHttp(MockHttp):
                     httplib.responses[httplib.CREATED])
         raise NotImplementedError()
 
+    def _v3_users_a(self, method, url, body, headers):
+        if method == 'PATCH':
+            # enable / disable user
+            body = self.fixtures.load('v3_users_a.json')
+            return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK])
+        raise NotImplementedError()
+
     def _v3_roles(self, method, url, body, headers):
         if method == 'GET':
             body = self.fixtures.load('v3_roles.json')


[2/4] git commit: Update doap file.

Posted by to...@apache.org.
Update doap file.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cbd2ae65
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cbd2ae65
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cbd2ae65

Branch: refs/heads/trunk
Commit: cbd2ae659e5a5bb675355c039880b19fd641dbd0
Parents: 7557d7b
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Aug 15 15:57:05 2014 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Aug 15 15:57:05 2014 +0200

----------------------------------------------------------------------
 doap_libcloud.rdf | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/cbd2ae65/doap_libcloud.rdf
----------------------------------------------------------------------
diff --git a/doap_libcloud.rdf b/doap_libcloud.rdf
index 2bfca57..c6c5250 100644
--- a/doap_libcloud.rdf
+++ b/doap_libcloud.rdf
@@ -196,6 +196,48 @@
         <revision>0.13.2</revision>
       </Version>
   </release>
+  <release>
+      <Version>
+        <name>0.13.3</name>
+        <created>2013-12-31</created>
+        <revision>0.13.3</revision>
+      </Version>
+  </release>
+  <release>
+      <Version>
+        <name>0.14.0-beta3</name>
+        <created>2013-11-21</created>
+        <revision>0.14.0-beta3</revision>
+      </Version>
+  </release>
+  <release>
+      <Version>
+        <name>0.14.0</name>
+        <created>2014-01-22</created>
+        <revision>0.14.0</revision>
+      </Version>
+  </release>
+  <release>
+      <Version>
+        <name>0.15.0</name>
+        <created>2014-06-26</created>
+        <revision>0.15.0</revision>
+      </Version>
+  </release>
+  <release>
+      <Version>
+        <name>0.15.1</name>
+        <created>2014-07-10</created>
+        <revision>0.15.1</revision>
+      </Version>
+  </release>
+  <release>
+      <Version>
+        <name>0.14.1</name>
+        <created>2014-02-08</created>
+        <revision>0.14.1</revision>
+      </Version>
+  </release>
     <repository>
       <SVNRepository>
         <location rdf:resource="https://svn.apache.org/repos/asf/libcloud/trunk/"/>


[4/4] git commit: Add missing fixture.

Posted by to...@apache.org.
Add missing fixture.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/950f972c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/950f972c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/950f972c

Branch: refs/heads/trunk
Commit: 950f972c3bcd05ef29afdf2eaba8fafadfa02d03
Parents: 8b8b67c
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Aug 15 16:17:53 2014 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Aug 15 16:17:53 2014 +0200

----------------------------------------------------------------------
 .../fixtures/openstack_identity/v3_users_a.json   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/950f972c/libcloud/test/compute/fixtures/openstack_identity/v3_users_a.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/openstack_identity/v3_users_a.json b/libcloud/test/compute/fixtures/openstack_identity/v3_users_a.json
new file mode 100644
index 0000000..4d0a359
--- /dev/null
+++ b/libcloud/test/compute/fixtures/openstack_identity/v3_users_a.json
@@ -0,0 +1,18 @@
+{
+    "user": 
+      {
+          "name": "cloud",
+          "links": {
+              "self": "http://192.168.18.100:5000/v3/users/a"
+          },
+          "domain_id": "default",
+          "enabled": true,
+          "email": "openstack-test@localhost",
+          "id": "a"
+      },
+    "links": {
+        "self": "http://192.168.18.100:5000/v3/users",
+        "previous": null,
+        "next": null
+    }
+}


[3/4] git commit: Fix ParamikoSSHClient.run() so that it works in Python 3.x by decoding incoming bytes into strings using the bytes decode method.

Posted by to...@apache.org.
Fix ParamikoSSHClient.run() so that it works in Python 3.x by decoding incoming
bytes into strings using the bytes decode method.

Closes #347

Signed-off-by: Tomaz Muraus <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8b8b67cf
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8b8b67cf
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8b8b67cf

Branch: refs/heads/trunk
Commit: 8b8b67cf78b42a861b67b289d9ca9d0f812e7f93
Parents: cbd2ae6
Author: Eddy Reyes <er...@users.noreply.github.com>
Authored: Thu Aug 14 13:11:28 2014 -0500
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Aug 15 16:14:24 2014 +0200

----------------------------------------------------------------------
 CHANGES.rst             | 5 +++++
 libcloud/compute/ssh.py | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8b8b67cf/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index edc1711..a7943bb 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -61,6 +61,11 @@ Compute
   (GITHUB-346)
   [Roeland Kuipers]
 
+- Fix ``ParamikoSSHClient.run`` and ``deploy_node`` method to work correctly
+  under Python 3.
+  (GITHUB-347)
+  [Eddy Reyes]
+
 Storage
 ~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/8b8b67cf/libcloud/compute/ssh.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/ssh.py b/libcloud/compute/ssh.py
index af9c43a..1a88e9f 100644
--- a/libcloud/compute/ssh.py
+++ b/libcloud/compute/ssh.py
@@ -40,6 +40,7 @@ from os.path import join as pjoin
 
 from libcloud.utils.logging import ExtraLogFormatter
 from libcloud.utils.py3 import StringIO
+from libcloud.utils.py3 import b
 
 __all__ = [
     'BaseSSHClient',
@@ -364,7 +365,7 @@ class ParamikoSSHClient(BaseSSHClient):
                 data = chan.recv(CHUNK_SIZE)
 
                 while data:
-                    stdout.write(data)
+                    stdout.write(b(data).decode('utf-8'))
                     ready = chan.recv_ready()
 
                     if not ready:
@@ -376,7 +377,7 @@ class ParamikoSSHClient(BaseSSHClient):
                 data = chan.recv_stderr(CHUNK_SIZE)
 
                 while data:
-                    stderr.write(data)
+                    stderr.write(b(data).decode('utf-8'))
                     ready = chan.recv_stderr_ready()
 
                     if not ready: