diff --git a/changelogs/fragments/49084-influxdb_user-default-password-fix.yaml b/changelogs/fragments/49084-influxdb_user-default-password-fix.yaml new file mode 100644 index 00000000000..81188af66c0 --- /dev/null +++ b/changelogs/fragments/49084-influxdb_user-default-password-fix.yaml @@ -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. diff --git a/lib/ansible/modules/database/influxdb/influxdb_user.py b/lib/ansible/modules/database/influxdb/influxdb_user.py index 52a2057006a..3ec22ef6ab7 100644 --- a/lib/ansible/modules/database/influxdb/influxdb_user.py +++ b/lib/ansible/modules/database/influxdb/influxdb_user.py @@ -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':