typo in relation set

This commit is contained in:
yolanda.robla@canonical.com 2014-02-28 17:22:14 +01:00
parent 4e803414f4
commit a3e6326077
1 changed files with 1 additions and 6 deletions

View File

@ -46,23 +46,18 @@ def configure_amqp(username, vhost):
# get and update service password
password = None
cluster_rels = hookenv.relation_ids('cluster')
utils.juju_log('INFO', 'in configure amqp: %s , length %s' % (str(cluster_rels), str(len(cluster_rels))))
if len(cluster_rels)>0:
cluster_rid = cluster_rels[0]
utils.juju_log('INFO', 'cluster rid is: %s' % str(cluster_rid))
password = hookenv.relation_get(attribute='%s.passwd' % username,
rid=cluster_rid,
unit=hookenv.local_unit())
utils.juju_log('INFO', 'password is: %s' % str(password))
new_passwd = False
if not password:
utils.juju_log('INFO', 'pass not exists')
new_passwd = True
password = pwgen(length=64)
if len(cluster_rels)>0:
# update password in cluster
utils.juju_log('INFO', 'set new password %s' % str(password))
hookenv.relation_set(rid=cluster_rid,
hookenv.relation_set(relation_id=cluster_rid,
relation_settings={'%s.passwd' % username: password})
# refresh password in file