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
This commit is contained in:
parent
45f5a8a9a6
commit
11bfc1e529
|
@ -396,7 +396,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