Region update extra support

The region update API currently does not allow for adding any
extra values via the update API. This effectively means that while
an extra can be set at create time, they cannot be altered once
set, nor can any additional values be added.

This patch add the missing inclusion of extra to the new ref.

Change-Id: I6e99764c0e360656ddbb47ebb23fe9576c97b99f
Closes-Bug: #1729933
This commit is contained in:
David Lyle 2017-11-03 14:50:58 -06:00 committed by Gage Hugo
parent d8baf3c6ab
commit ef331f46b4
4 changed files with 28 additions and 0 deletions

View File

@ -174,6 +174,7 @@ class Catalog(base.CatalogDriverBase):
for attr in Region.attributes:
if attr != 'id':
setattr(ref, attr, getattr(new_region, attr))
ref.extra = new_region.extra
return ref.to_dict()
# Services

View File

@ -151,6 +151,20 @@ class CatalogTests(object):
self.assertEqual(new_description['description'],
current_region['description'])
def test_update_region_extras(self):
new_region = unit.new_region_ref()
region_id = new_region['id']
PROVIDERS.catalog_api.create_region(new_region)
email = 'keystone@openstack.org'
new_ref = {'description': uuid.uuid4().hex,
'email': email}
PROVIDERS.catalog_api.update_region(region_id, new_ref)
current_region = PROVIDERS.catalog_api.get_region(region_id)
self.assertEqual(email,
current_region['email'])
def test_create_region_with_duplicate_id(self):
new_region = unit.new_region_ref()
PROVIDERS.catalog_api.create_region(new_region)

View File

@ -249,6 +249,9 @@ class TestTemplatedCatalog(unit.TestCase, catalog_tests.CatalogTests):
def test_invalidate_cache_when_updating_region(self):
self.skip_test_overrides(BROKEN_WRITE_FUNCTIONALITY_MSG)
def test_update_region_extras(self):
self.skip_test_overrides(BROKEN_WRITE_FUNCTIONALITY_MSG)
def test_create_region_with_duplicate_id(self):
self.skip_test_overrides(BROKEN_WRITE_FUNCTIONALITY_MSG)

View File

@ -0,0 +1,10 @@
---
fixes:
- |
[`bug 1729933 <https://bugs.launchpad.net/keystone/+bug/1729933>`_]
The Region Update API now correctly updates extra values. Previously
adding any extra values to a region via the update API would discard
any added values besides the default ones. Any extra values are now
correctly added and returned. This fix was for consistency with other
APIs in keystone that use 'extra' and the use of 'extra' in
keystone is highly discouraged.