Do not access DB when it is in maintenance mode.

If the database is in maintenace mode do not attempt to access
it.

Depends-On: I5d8ed7d3935db5568c50f8d585e37a4d0cc6914f
Change-Id: I91d3f858888a169cf85d51533a54ef37d7a72c58
This commit is contained in:
Liam Young 2020-01-30 12:37:56 +00:00
parent de4e9ec338
commit c9e844a4a3
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,7 @@ from charmhelpers.contrib.openstack.utils import (
CompareOpenStackReleases,
series_upgrade_prepare,
series_upgrade_complete,
is_db_maintenance_mode,
)
from charmhelpers.contrib.openstack.ha.utils import (
generate_ha_relation_data,
@ -330,6 +331,9 @@ def db_joined():
@hooks.hook('shared-db-relation-changed')
@restart_on_change(restart_map(), stopstart=True, sleep=3)
def db_changed():
if is_db_maintenance_mode():
log('Database maintenance mode, aborting hook.')
return
resolve_CONFIGS()
if 'shared-db' not in CONFIGS.complete_contexts():
log('shared-db relation incomplete. Peer not ready?')