changes in password

This commit is contained in:
yolanda.robla@canonical.com 2014-02-28 08:53:21 +01:00
parent 0b8d90c9a2
commit bce8e4f0d7
1 changed files with 12 additions and 8 deletions

View File

@ -123,14 +123,18 @@ def amqp_changed(relation_id=None, remote_unit=None):
utils.relation_set(**relation_settings) utils.relation_set(**relation_settings)
else: else:
# resync pass on slave # resync pass on slave
settings = hookenv.relation_get(rid=relation_id, unit=remote_unit) services_password = {}
if 'password' in settings: for r_id in (utils.relation_ids('cluster') or []):
write_file(rabbit.LIB_PATH+settings['username']+'.passwd', settings['password'], for unit in utils.relation_list(r_id):
rabbit.RABBIT_USER, rabbit.RABBIT_USER, 0660) # get current passwords
else: services_password = hookenv.relation_get('services_password', rid=r_id, unit=unit)
# still not set, wait if services_password is not None:
utils.juju_log('INFO', 'Service password still not set. Relation not ready') services_password = json.loads(base64.b64decode(services_password))
sys.exit(0) if len(services_password.keys())>0:
break
# iterate over all services and copy passwords
for key, value in services_password.items():
write_file(rabbit.LIB_PATH+key, value, rabbit.RABBIT_USER, rabbit.RABBIT_USER, 0660)
def cluster_joined(): def cluster_joined():