diff --git a/interface_ceph_client/ceph_client.py b/interface_ceph_client/ceph_client.py index 74efdb7..13c3fed 100755 --- a/interface_ceph_client/ceph_client.py +++ b/interface_ceph_client/ceph_client.py @@ -56,8 +56,12 @@ class CephClientRequires(Object): self.previous_requests = self.get_previous_requests_from_relations() def on_joined(self, event): - relation = self.model.relations[self.relation_name] - if relation: + relations = self.model.relations[self.relation_name] + if relations: + # Setup unit-name for CMR on the relation + for relation in relations: + relation.data[self.this_unit]["unit-name"] = \ + self.this_unit.name logging.info("emiting broker_available") self._stored.broker_available = True self.on.broker_available.emit() diff --git a/unit_tests/test_interface_ceph_client.py b/unit_tests/test_interface_ceph_client.py index 2515c42..1c0764d 100644 --- a/unit_tests/test_interface_ceph_client.py +++ b/unit_tests/test_interface_ceph_client.py @@ -83,6 +83,7 @@ class TestCephClientRequires(unittest.TestCase): 'client/0': { 'remote_unit_data': { 'ingress-address': '192.0.2.4', + 'unit-name': 'client/0', 'broker_req': ( '{"api-version": 1, ' '"ops": [{"op": "create-pool", "name": "tmbtil", '