You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by vd...@apache.org on 2018/11/29 07:40:20 UTC
[1/2] libcloud git commit: openstack: handle missing user "enabled"
attribute
Repository: libcloud
Updated Branches:
refs/heads/trunk 080b343e0 -> 9f3147172
openstack: handle missing user "enabled" attribute
Keystone may not always return an "enabled" attribute for a user
account. Prior to this change, we could crash if we queried a user that
lacked an "enabled" attribute. Gracefully handle this case by setting
"enabled" to None.
Signed-off-by: Rick van de Loo <ri...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a61877de
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a61877de
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a61877de
Branch: refs/heads/trunk
Commit: a61877de33c868f4c20515706a0fbb73464ac2e7
Parents: 080b343
Author: Ken Dreyer <kd...@redhat.com>
Authored: Wed Nov 28 13:46:55 2018 -0700
Committer: Rick van de Loo <ri...@gmail.com>
Committed: Thu Nov 29 08:36:06 2018 +0100
----------------------------------------------------------------------
libcloud/common/openstack_identity.py | 2 +-
libcloud/test/common/test_openstack_identity.py | 13 +++++++++++++
.../fixtures/openstack_identity/v3/v3_users_c.json | 14 ++++++++++++++
3 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a61877de/libcloud/common/openstack_identity.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack_identity.py b/libcloud/common/openstack_identity.py
index f608244..53646a3 100644
--- a/libcloud/common/openstack_identity.py
+++ b/libcloud/common/openstack_identity.py
@@ -1383,7 +1383,7 @@ class OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection):
email=data.get('email'),
description=data.get('description',
None),
- enabled=data['enabled'])
+ enabled=data.get('enabled'))
return user
def _to_roles(self, data):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a61877de/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 e91c0b9..91dba7e 100644
--- a/libcloud/test/common/test_openstack_identity.py
+++ b/libcloud/test/common/test_openstack_identity.py
@@ -379,6 +379,12 @@ class OpenStackIdentity_3_0_ConnectionTests(unittest.TestCase):
self.assertEqual(user.name, 'userwithoutemail')
self.assertEqual(user.email, None)
+ def test_get_user_without_enabled(self):
+ user = self.auth_instance.get_user(user_id='c')
+ self.assertEqual(user.id, 'c')
+ self.assertEqual(user.name, 'userwithoutenabled')
+ self.assertEqual(user.enabled, None)
+
def test_create_user(self):
user = self.auth_instance.create_user(email='test2@localhost', password='test1',
name='test2', domain_id='default')
@@ -712,6 +718,13 @@ class OpenStackIdentity_3_0_MockHttp(MockHttp):
return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK])
raise NotImplementedError()
+ def _v3_users_c(self, method, url, body, headers):
+ if method == 'GET':
+ # look up a user
+ body = self.fixtures.load('v3_users_c.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')
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a61877de/libcloud/test/compute/fixtures/openstack_identity/v3/v3_users_c.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/openstack_identity/v3/v3_users_c.json b/libcloud/test/compute/fixtures/openstack_identity/v3/v3_users_c.json
new file mode 100644
index 0000000..f254dcf
--- /dev/null
+++ b/libcloud/test/compute/fixtures/openstack_identity/v3/v3_users_c.json
@@ -0,0 +1,14 @@
+{
+ "user":
+ {
+ "name": "userwithoutenabled",
+ "links": {
+ "self": "http://192.168.18.100:5000/v3/users/c"
+ },
+ "domain_id": "default",
+ "id": "c",
+ "email": "c@example.com",
+ "password_expires_at": null,
+ "options": {}
+ }
+}
[2/2] libcloud git commit: Add changes for #1254
Posted by vd...@apache.org.
Add changes for #1254
Closes #1254
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9f314717
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9f314717
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9f314717
Branch: refs/heads/trunk
Commit: 9f314717242daee23d1edae56d9548286a7eb768
Parents: a61877d
Author: Rick van de Loo <ri...@gmail.com>
Authored: Thu Nov 29 08:38:24 2018 +0100
Committer: Rick van de Loo <ri...@gmail.com>
Committed: Thu Nov 29 08:38:24 2018 +0100
----------------------------------------------------------------------
CHANGES.rst | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9f314717/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 99029e7..ba375cc 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -7,10 +7,10 @@ Changes in Apache Libcloud in development
- Add loadbalancer and compute drivers for NTT-CIS, rename dimensiondata modules to NTT-CIS (GITHUB-1250)
[Mitch Raful]
-Container
-~~~~~~~~~
+Common
+~~~~~~
-- [Docker] Improve docstring for RegistryClient (GITHUB-1254)
+- [OpenStack] Handle missing user "enabled" attribute (GITHUB-1261)
[Ken Dreyer]
Compute
@@ -22,6 +22,12 @@ Compute
- [UpCloud] Update documentation for UpCloud driver (LIBCLOUD-1026, GITHUB-1259)
[Ilari Mäkelä]
+Container
+~~~~~~~~~
+
+- [Docker] Improve docstring for RegistryClient (GITHUB-1254)
+ [Ken Dreyer]
+
Changes in Apache Libcloud 2.4.0
--------------------------------