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: I7d5b7a20573b38d12b1ead708ee446472f21e9f8
This commit is contained in:
parent
4808e06ffa
commit
90ecd0f771
|
@ -398,6 +398,12 @@ def db_changed():
|
|||
hookenv.log('shared-db relation incomplete. Peer not ready?')
|
||||
return
|
||||
|
||||
if ch_utils.is_db_maintenance_mode():
|
||||
hookenv.log(
|
||||
'Database maintenance mode, aborting hook.',
|
||||
level=hookenv.DEBUG)
|
||||
return
|
||||
|
||||
CONFIGS.write_all()
|
||||
leader_init_db_if_ready()
|
||||
# db init for cells v2 requires amqp transport_url and db connections to
|
||||
|
|
|
@ -40,6 +40,7 @@ TO_PATCH = [
|
|||
'charmhelpers.contrib.openstack.utils.configure_installation_source',
|
||||
'charmhelpers.contrib.openstack.utils.config_value_changed',
|
||||
'charmhelpers.contrib.openstack.utils.is_unit_paused_set',
|
||||
'charmhelpers.contrib.openstack.utils.is_db_maintenance_mode',
|
||||
'charmhelpers.contrib.openstack.utils.openstack_upgrade_available',
|
||||
'charmhelpers.contrib.openstack.utils.os_release',
|
||||
'charmhelpers.core.hookenv.charm_dir',
|
||||
|
@ -105,6 +106,7 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
self.charm_dir.return_value = '/var/lib/juju/charms/nova/charm'
|
||||
self.ns_query.return_value = None
|
||||
self.is_unit_paused_set.return_value = False
|
||||
self.is_db_maintenance_mode.return_value = False
|
||||
# disable hardening for unit tests
|
||||
harden._DISABLE_HARDENING_FOR_UNIT_TEST = True
|
||||
|
||||
|
|
Loading…
Reference in New Issue