From fe3097f9d7940a74dc4635ce8d67db22426b3917 Mon Sep 17 00:00:00 2001 From: James Page Date: Wed, 13 Mar 2019 11:05:10 +0000 Subject: [PATCH] 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 --- hooks/ceph_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/ceph_hooks.py b/hooks/ceph_hooks.py index 2de99fc2..30492096 100755 --- a/hooks/ceph_hooks.py +++ b/hooks/ceph_hooks.py @@ -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'),