From f7a29dadb804e4dccaf4338d5998e801e86d2a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Ur=C3=ADa?= Date: Wed, 9 Mar 2016 10:50:57 +0100 Subject: [PATCH] scope from GLOBAL to UNIT and use data from 1 unit (rest is the same) --- requires.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/requires.py b/requires.py index 85be890..ab80196 100644 --- a/requires.py +++ b/requires.py @@ -16,7 +16,7 @@ from charms.reactive import scopes class KeystoneRequires(RelationBase): - scope = scopes.GLOBAL + scope = scopes.UNIT # These remote data fields will be automatically mapped to accessors # with a basic documentation string provided. @@ -29,7 +29,7 @@ class KeystoneRequires(RelationBase): def changed(self): conv = self.conversation() conv.set_state('{relation_name}.connected') - if self.auth_data_complete() + if self.auth_data_complete(): conv.set_state('{relation_name}.available') else: conv.remove_state('{relation_name}.available') @@ -44,12 +44,13 @@ class KeystoneRequires(RelationBase): """ Returns a dict of keystone admin credentials """ + conv = self.conversation() return { - 'service_hostname': self.service_hostname(), - 'service_port': self.service_port(), - 'service_username': self.service_username(), - 'service_password': self.service_password(), - 'service_tenant_name': self.service_tenant_name() + 'service_hostname': conv.get_remote('service_hostname'), + 'service_port': conv.get_remote('service_port'), + 'service_username': conv.get_remote('service_username'), + 'service_password': conv.get_remote('service_password'), + 'service_tenant_name': conv.get_remote('service_tenant_name') } def auth_data_complete(self):