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

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

* Added changelog fragment
pull/48644/head
Michael Rose 6 years ago committed by ansibot
parent b079070688
commit b422c59ada

@ -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.

@ -157,7 +157,7 @@ def main():
state = module.params['state'] state = module.params['state']
user_name = module.params['user_name'] user_name = module.params['user_name']
user_password = module.params['user_password'] or '' user_password = module.params['user_password']
admin = module.params['admin'] admin = module.params['admin']
influxdb = influx.InfluxDb(module) influxdb = influx.InfluxDb(module)
client = influxdb.connect_to_influxdb() client = influxdb.connect_to_influxdb()
@ -167,7 +167,7 @@ def main():
if user: if user:
changed = False changed = False
if not check_user_password(module, client, user_name, user_password): if not check_user_password(module, client, user_name, user_password) and user_password is not None:
set_user_password(module, client, user_name, user_password) set_user_password(module, client, user_name, user_password)
changed = True changed = True
@ -183,6 +183,7 @@ def main():
module.exit_json(changed=changed) module.exit_json(changed=changed)
else: else:
user_password = user_password or ''
create_user(module, client, user_name, user_password, admin) create_user(module, client, user_name, user_password, admin)
if state == 'absent': if state == 'absent':

Loading…
Cancel
Save