Backport/2.7/49084 (#49973)

* influxdb_user: Fixed default password behavior (#47040)

(cherry picked from commit 1eed8900ed)

* Amends #47040 - influxdb_user - Prevents potential accidental password changes to blank (#49084)

* Amends #47040 - Prevents potential accidental password changes to blank

* Added changelog fragment

(cherry picked from commit b422c59ada)
This commit is contained in:
Michael Rose 2019-01-07 09:25:36 -08:00 committed by Toshio Kuratomi
parent a9fd20318c
commit 898ec291b0
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- influxdb_user - An unspecified password now sets the password to blank, except on existing users. This previously caused an unhandled exception.

View file

@ -166,11 +166,12 @@ def main():
if state == 'present':
if user:
if check_user_password(module, client, user_name, user_password):
if user_password is None or check_user_password(module, client, user_name, user_password):
module.exit_json(changed=False)
else:
set_user_password(module, client, user_name, user_password)
else:
user_password = user_password or ''
create_user(module, client, user_name, user_password, admin)
if state == 'absent':