Disable API query when unit is paused

When the unit is paused the charm should not attempt to run
update_all_identity_relation_units because it depends on the
Keystone API being available.

Closes-Bug: 1648016

Change-Id: I58fc0639791eed16c11ec836746e912e715588d9
This commit is contained in:
Liam Young 2016-12-07 10:47:55 +00:00
parent bcb72ecfe1
commit 2b66f2f66a
2 changed files with 14 additions and 2 deletions

View File

@ -314,6 +314,8 @@ def pgsql_db_joined():
def update_all_identity_relation_units(check_db_ready=True):
CONFIGS.write_all()
if is_unit_paused_set():
return
if check_db_ready and not is_db_ready():
log('Allowed_units list provided and this unit not present',
level=INFO)

View File

@ -680,13 +680,23 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
u.log.debug('OK')
def test_901_pause_resume(self):
"""Test pause and resume actions."""
"""Test pause and resume actions.
NOTE: Toggle setting when service is paused to check config-changed
hook respects pause Bug #1648016
"""
# Expected default and alternate values
set_default = {'use-syslog': 'False'}
set_alternate = {'use-syslog': 'True'}
self._assert_services(should_run=True)
action_id = u.run_action(self.keystone_sentry, "pause")
assert u.wait_on_action(action_id), "Pause action failed."
self._assert_services(should_run=False)
self.d.configure('keystone', set_alternate)
action_id = u.run_action(self.keystone_sentry, "resume")
assert u.wait_on_action(action_id), "Resume action failed"
self._assert_services(should_run=True)
self.d.configure('keystone', set_default)
self._auto_wait_for_status(message="Unit is ready",
include_only=['keystone'])