Read only provider side of database relation
Since upgrade of mysql relation (and secrets), only the application's leader can lead the whole relation databag. Non-leader requiring units are only allowed to read the provider side of the relation and their own unit's. Change-Id: Iee073d654cabfbdefc817ea7c0207f3f28c457ac
This commit is contained in:
parent
35b4e10e30
commit
7285775f54
@ -332,10 +332,11 @@ class DBHandler(RelationHandler):
|
||||
|
||||
def get_relation_data(self) -> dict:
|
||||
"""Load the data from the relation for consumption in the handler."""
|
||||
if len(self.interface.relations) > 0:
|
||||
return self.interface.relations[0].data[
|
||||
self.interface.relations[0].app
|
||||
]
|
||||
# there is at most one relation for a database
|
||||
for relation in self.model.relations[self.relation_name]:
|
||||
if relation.app is None:
|
||||
continue
|
||||
return relation.data[relation.app]
|
||||
return {}
|
||||
|
||||
@property
|
||||
|
Loading…
x
Reference in New Issue
Block a user