diff --git a/plugins/modules/guacamole_connection.py b/plugins/modules/guacamole_connection.py index 6b7cf18..1a6931b 100644 --- a/plugins/modules/guacamole_connection.py +++ b/plugins/modules/guacamole_connection.py @@ -561,6 +561,7 @@ def main(): if 'name' in connection: if connection['name'] == module.params.get('connection_name'): result['connection_info'] = connection + break module.exit_json(**result) diff --git a/plugins/modules/guacamole_connections_group.py b/plugins/modules/guacamole_connections_group.py index 23f4fa7..e862a75 100644 --- a/plugins/modules/guacamole_connections_group.py +++ b/plugins/modules/guacamole_connections_group.py @@ -315,6 +315,7 @@ def main(): if group_info['name'] == module.params.get('group_name'): group_numeric_id = group_info['identifier'] guacamole_connections_group_exists = True + break # module arg state=present so we have to create a new connections group # or update an existing one @@ -437,10 +438,12 @@ def main(): for group_id, group_info in guacamole_connections_groups_after.items(): if group_info['name'] == module.params.get('group_name'): result['connections_group_info'] = group_info + break else: for group_id, group_info in guacamole_connections_groups_before.items(): if group_info['name'] == module.params.get('group_name'): result['connections_group_info'] = group_info + break module.exit_json(**result) diff --git a/plugins/modules/guacamole_user.py b/plugins/modules/guacamole_user.py index a3fca9c..640ec2d 100644 --- a/plugins/modules/guacamole_user.py +++ b/plugins/modules/guacamole_user.py @@ -444,8 +444,8 @@ def main(): # check if the user already exists in guacamole guacamole_user_exists = False - for user in guacamole_users_before.items(): - if user[1]['username'] == module.params.get('username'): + for username, userinfo in guacamole_users_before.items(): + if username == module.params.get('username'): guacamole_user_exists = True break @@ -606,6 +606,7 @@ def main(): for username, userinfo in guacamole_users_after.items(): if username == module.params.get('username'): result['user_info'] = userinfo + break module.exit_json(**result)