Drop use of 'amqp.requested-access' flag

In an amqp relation is removed and re-added, the charm won't
make a new request for access.  As the handler simply sets two
data items on the relation, avoid the use of the requested-access
flag.

Change-Id: Ibbffabe277adacf966443bae04a6a64a07964261
Closes-Bug: 1784076
This commit is contained in:
James Page 2018-11-22 15:35:23 +00:00
parent 7075c5d332
commit 53c204a796
2 changed files with 1 additions and 6 deletions

View File

@ -69,7 +69,6 @@ def install_packages():
with provide_charm_instance() as instance:
instance.install()
reactive.set_state('installed')
reactive.remove_state('amqp.requested-access')
reactive.remove_state('shared-db.setup')
reactive.remove_state('base-config.rendered')
reactive.remove_state('db.synched')
@ -77,12 +76,10 @@ def install_packages():
@reactive.when('amqp.connected')
@reactive.when_not('amqp.requested-access')
def setup_amqp_req(amqp):
"""Send request for rabbit access and vhost"""
amqp.request_access(username='designate',
vhost='openstack')
reactive.set_state('amqp.requested-access')
@reactive.when('shared-db.connected')

View File

@ -84,8 +84,7 @@ class TestHandlers(test_utils.PatchHelper):
self.patch_object(handlers.reactive, 'remove_state')
handlers.install_packages()
the_charm.install.assert_called_once_with()
calls = [mock.call('amqp.requested-access'),
mock.call('shared-db.setup'),
calls = [mock.call('shared-db.setup'),
mock.call('base-config.rendered'),
mock.call('db.synched')]
self.remove_state.assert_has_calls(calls)
@ -96,7 +95,6 @@ class TestHandlers(test_utils.PatchHelper):
handlers.setup_amqp_req(amqp)
amqp.request_access.assert_called_once_with(
username='designate', vhost='openstack')
self.set_state.assert_called_once_with('amqp.requested-access')
def test_database(self):
database = mock.MagicMock()