Merge "Support endpoint updates in bootstrap"

This commit is contained in:
Zuul 2019-04-27 00:17:26 +00:00 committed by Gerrit Code Review
commit fd0f7e14fa
3 changed files with 34 additions and 4 deletions

View File

@ -317,9 +317,10 @@ class Bootstrapper(object):
LOG.info('Created %(interface)s endpoint %(url)s',
{'interface': interface, 'url': url})
else:
# NOTE(jamielennox): electing not to update existing
# endpoints here. There may be call to do so in future.
LOG.info('Skipping %s endpoint as already created',
interface)
endpoint_ref['url'] = url
PROVIDERS.catalog_api.update_endpoint(
endpoint_id=endpoint_ref['id'],
endpoint_ref=endpoint_ref)
LOG.info('%s endpoint updated', interface)
self.endpoints[interface] = endpoint_ref['id']

View File

@ -404,6 +404,21 @@ class CliBootStrapTestCaseWithEnvironment(CliBootStrapTestCase):
self._do_test_bootstrap(self.bootstrap)
def test_endpoints_created_with_new_endpoints(self):
service = unit.new_service_ref(name=self.service_name, type='identity')
PROVIDERS.catalog_api.create_service(service['id'], service)
region = unit.new_region_ref(id=self.region_id)
PROVIDERS.catalog_api.create_region(region)
endpoint = unit.new_endpoint_ref(interface='public',
service_id=service['id'],
url=uuid.uuid4().hex,
region_id=self.region_id)
PROVIDERS.catalog_api.create_endpoint(endpoint['id'], endpoint)
self._do_test_bootstrap(self.bootstrap)
updated_endpoint = PROVIDERS.catalog_api.get_endpoint(endpoint['id'])
self.assertEqual(updated_endpoint['url'], self.bootstrap.public_url)
class CliDomainConfigAllTestCase(unit.SQLDriverOverrides, unit.TestCase):

View File

@ -0,0 +1,14 @@
---
features:
- |
The ``keystone-manage bootstrap`` command can now be used to update
existing endpoints idempotently, which is useful in conjunction with
configuration management tools that use this command for both
initialization and lifecycle management of keystone.
upgrade:
- |
The ``keystone-manage bootstrap`` command will now update existing
endpoints rather than skipping them if they already exist but are different
from the values provided to the command. This is useful in conjunction with
configuration management tools that use this command for both
initialization and lifecycle management of keystone.