Use provided unit scope in db_changed
If the unit parameter is passed to the db_changed function, ensure
that its used instead of the remote_unit function so that db_changed
can be called outside of the db-relation-changed hook context.
Change-Id: I30b42522ed982213176e485a1140ed872fc571df
Closes-Bug: 1688401
(cherry picked from commit 11bfc1e529
)
This commit is contained in:
parent
189e5377e0
commit
adc5d12a66
|
@ -354,7 +354,7 @@ def db_changed(relation_id=None, unit=None, admin=None):
|
|||
if admin not in [True, False]:
|
||||
admin = relation_type() == 'db-admin'
|
||||
|
||||
db_name, _ = remote_unit().split("/")
|
||||
db_name, _ = (unit or remote_unit()).split("/")
|
||||
username = db_name
|
||||
db_helper = get_db_helper()
|
||||
addr = relation_get('private-address', unit=unit, rid=relation_id)
|
||||
|
|
Loading…
Reference in New Issue