Unset DB init flag on shared-db relation removal

The keystone charm sets db-initialised to true after initializing the
database the first time.  However, if the database application is
removed, this flag is not unset.

This results in breakage on attempts to re-add a shared-db relation
with a new database application, as the charm will not attempt to
re-initialize the database prior to doing DB operations.

This fix simply ensures that we unset this flag prior to finalizing
removal of the shared-db relation.

Change-Id: I78ae12fda05ce006939b2d90a3d738bacb815915
Closes-Bug: #1797229
This commit is contained in:
Paul Goins 2019-02-22 10:12:32 -08:00
parent 2dca259156
commit a87b101106
3 changed files with 10 additions and 0 deletions

View File

@ -50,6 +50,7 @@ from charmhelpers.core.hookenv import (
open_port,
is_leader,
relation_id,
leader_set,
)
from charmhelpers.core.host import (
@ -393,6 +394,13 @@ def db_changed():
update_all_identity_relation_units()
@hooks.hook('shared-db-relation-departed',
'shared-db-relation-broken')
def db_departed_or_broken():
if is_leader():
leader_set({'db-initialised': None})
@hooks.hook('identity-service-relation-changed')
@restart_on_change(restart_map(), restart_functions=restart_function_map())
def identity_changed(relation_id=None, remote_unit=None):

View File

@ -0,0 +1 @@
keystone_hooks.py

View File

@ -0,0 +1 @@
keystone_hooks.py