summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-12-17 03:35:48 +0000
committerGerrit Code Review <review@openstack.org>2014-12-17 03:35:48 +0000
commit18304c52f60002ff74b0eaf07f4ef9e078a755e1 (patch)
treee2d11d380207433bb9ee52aced82bc687a0c3c77
parentf68f26f5cd9a1094bf4ca72b2755190d8151a598 (diff)
parentb6f7cad8ba432e6d3e33812238620e768c529996 (diff)
downloadkeystone-18304c52f60002ff74b0eaf07f4ef9e078a755e1.tar.gz
Merge "Fix modifying a role with same name using LDAP"2015.1.0b1
-rw-r--r--keystone/assignment/backends/ldap.py7
-rw-r--r--keystone/tests/test_backend_ldap.py8
2 files changed, 4 insertions, 11 deletions
diff --git a/keystone/assignment/backends/ldap.py b/keystone/assignment/backends/ldap.py
index 84eeeda3d..03a21a53a 100644
--- a/keystone/assignment/backends/ldap.py
+++ b/keystone/assignment/backends/ldap.py
@@ -686,9 +686,10 @@ class RoleApi(common_ldap.BaseLdap):
new_name = role.get('name')
if new_name is not None:
try:
- old_name = self.get_by_name(new_name)
- raise exception.Conflict(
- _('Cannot duplicate name %s') % old_name)
+ old_role = self.get_by_name(new_name)
+ if old_role['id'] != role_id:
+ raise exception.Conflict(
+ _('Cannot duplicate name %s') % old_role)
except exception.NotFound:
pass
return super(RoleApi, self).update(role_id, role)
diff --git a/keystone/tests/test_backend_ldap.py b/keystone/tests/test_backend_ldap.py
index 7a4e11185..76b52fc83 100644
--- a/keystone/tests/test_backend_ldap.py
+++ b/keystone/tests/test_backend_ldap.py
@@ -1916,14 +1916,6 @@ class LDAPIdentity(BaseLDAPIdentity, tests.TestCase):
self.assertEqual('crap', user_ref['id'])
self.assertEqual('Foo Bar', user_ref['name'])
- def test_update_role_same_name(self):
- # Override
- # This test is failing using the LDAP assignment backend, see
- # bug 1401721.
- # FIXME(blk-u): This should work.
- self.assertRaises(exception.Conflict,
- super(LDAPIdentity, self).test_update_role_same_name)
-
class LDAPIdentityEnabledEmulation(LDAPIdentity):
def setUp(self):