changes in password
This commit is contained in:
parent
0b8d90c9a2
commit
bce8e4f0d7
@ -123,14 +123,18 @@ def amqp_changed(relation_id=None, remote_unit=None):
|
||||
utils.relation_set(**relation_settings)
|
||||
else:
|
||||
# resync pass on slave
|
||||
settings = hookenv.relation_get(rid=relation_id, unit=remote_unit)
|
||||
if 'password' in settings:
|
||||
write_file(rabbit.LIB_PATH+settings['username']+'.passwd', settings['password'],
|
||||
rabbit.RABBIT_USER, rabbit.RABBIT_USER, 0660)
|
||||
else:
|
||||
# still not set, wait
|
||||
utils.juju_log('INFO', 'Service password still not set. Relation not ready')
|
||||
sys.exit(0)
|
||||
services_password = {}
|
||||
for r_id in (utils.relation_ids('cluster') or []):
|
||||
for unit in utils.relation_list(r_id):
|
||||
# get current passwords
|
||||
services_password = hookenv.relation_get('services_password', rid=r_id, unit=unit)
|
||||
if services_password is not None:
|
||||
services_password = json.loads(base64.b64decode(services_password))
|
||||
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():
|
||||
|
Loading…
Reference in New Issue
Block a user