Merge "Ensure password is set correctly on existing users"
This commit is contained in:
commit
5dc2bc56a8
|
@ -79,10 +79,7 @@ for need_user in need:
|
|||
detail = user_map[need_user]
|
||||
username = detail['username']
|
||||
if username not in have:
|
||||
if 'password' in detail:
|
||||
password = detail['password']
|
||||
else:
|
||||
password = base64.b64encode(os.urandom(40))
|
||||
password = detail.get('password', base64.b64encode(os.urandom(40)))
|
||||
subprocess.check_call(['rabbitmqctl', 'add_user', username, password],
|
||||
stdout=sys.stderr)
|
||||
if PASSWORD_HANDLE:
|
||||
|
@ -93,6 +90,12 @@ for need_user in need:
|
|||
PASSWORD_HANDLE])
|
||||
else:
|
||||
print('%s:%s' % (username, password))
|
||||
elif 'password' in detail:
|
||||
args = ['rabbitmqctl', 'change_password', username, detail['password']]
|
||||
subprocess.check_call(args, stdout=sys.stderr)
|
||||
# no "else", we have a user that exists, and no assertion about passwords. we
|
||||
# don't want to generate a new password if this is just a user that we're
|
||||
# setting user tags on.
|
||||
if 'permissions' in detail:
|
||||
args = ['rabbitmqctl', 'set_permissions', username]
|
||||
args.append(detail['permissions']['conf'])
|
||||
|
|
Loading…
Reference in New Issue