From c6ebfa548019a48095140c3f95b68ba8cede212e Mon Sep 17 00:00:00 2001 From: Guillaume Dufour Date: Sun, 28 Feb 2016 08:05:20 +0100 Subject: [PATCH] use python fallback to avoid error on old mongo version without roles --- database/misc/mongodb_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/misc/mongodb_user.py b/database/misc/mongodb_user.py index 848371884d6..e58857586eb 100644 --- a/database/misc/mongodb_user.py +++ b/database/misc/mongodb_user.py @@ -265,7 +265,7 @@ def main(): uinfo = user_find(client, user, db_name) if update_password != 'always' and uinfo: password = None - if 'roles' in uinfo and list(map((lambda x: x['role']), uinfo['roles'])) == roles: + if list(map((lambda x: x['role']), uinfo.get('roles', []))) == roles: module.exit_json(changed=False, user=user) try: