scope from GLOBAL to UNIT and use data from 1 unit (rest is the same)
This commit is contained in:
parent
11069e8eb9
commit
f7a29dadb8
15
requires.py
15
requires.py
|
@ -16,7 +16,7 @@ from charms.reactive import scopes
|
||||||
|
|
||||||
|
|
||||||
class KeystoneRequires(RelationBase):
|
class KeystoneRequires(RelationBase):
|
||||||
scope = scopes.GLOBAL
|
scope = scopes.UNIT
|
||||||
|
|
||||||
# These remote data fields will be automatically mapped to accessors
|
# These remote data fields will be automatically mapped to accessors
|
||||||
# with a basic documentation string provided.
|
# with a basic documentation string provided.
|
||||||
|
@ -29,7 +29,7 @@ class KeystoneRequires(RelationBase):
|
||||||
def changed(self):
|
def changed(self):
|
||||||
conv = self.conversation()
|
conv = self.conversation()
|
||||||
conv.set_state('{relation_name}.connected')
|
conv.set_state('{relation_name}.connected')
|
||||||
if self.auth_data_complete()
|
if self.auth_data_complete():
|
||||||
conv.set_state('{relation_name}.available')
|
conv.set_state('{relation_name}.available')
|
||||||
else:
|
else:
|
||||||
conv.remove_state('{relation_name}.available')
|
conv.remove_state('{relation_name}.available')
|
||||||
|
@ -44,12 +44,13 @@ class KeystoneRequires(RelationBase):
|
||||||
"""
|
"""
|
||||||
Returns a dict of keystone admin credentials
|
Returns a dict of keystone admin credentials
|
||||||
"""
|
"""
|
||||||
|
conv = self.conversation()
|
||||||
return {
|
return {
|
||||||
'service_hostname': self.service_hostname(),
|
'service_hostname': conv.get_remote('service_hostname'),
|
||||||
'service_port': self.service_port(),
|
'service_port': conv.get_remote('service_port'),
|
||||||
'service_username': self.service_username(),
|
'service_username': conv.get_remote('service_username'),
|
||||||
'service_password': self.service_password(),
|
'service_password': conv.get_remote('service_password'),
|
||||||
'service_tenant_name': self.service_tenant_name()
|
'service_tenant_name': conv.get_remote('service_tenant_name')
|
||||||
}
|
}
|
||||||
|
|
||||||
def auth_data_complete(self):
|
def auth_data_complete(self):
|
||||||
|
|
Loading…
Reference in New Issue