Ensure relation id is passed to remote_service_name

Its possible for the client_relation handler to be called from
outside of the original hook context; as a result use of
remote_service_name is not safe as this will evaluate in the
current hook context, rather than the relation_id/unit context
provided in the function parameters.

Passing the relation_id to the helper ensures that the
remote units for the intended relation are used to generate
the remote service name.

Change-Id: I2305a111c0a618156208e4f96acda5e63736051c
Closes-Bug: 1819892
This commit is contained in:
James Page 2019-03-13 11:05:10 +00:00
parent 17de051792
commit fe3097f9d7
1 changed files with 1 additions and 1 deletions

View File

@ -759,7 +759,7 @@ def client_relation(relid=None, unit=None):
if ready_for_service():
log('mon cluster in quorum and osds bootstrapped '
'- providing client with keys, processing broker requests')
service_name = hookenv.remote_service_name()
service_name = hookenv.remote_service_name(relid=relid)
public_addr = get_public_addr()
data = {'key': ceph.get_named_key(service_name),
'auth': config('auth-supported'),