From 22787e03d47448e8d935dda4eba7f9f791e13a52 Mon Sep 17 00:00:00 2001 From: Sven Meeus Date: Thu, 16 Apr 2020 14:48:33 +0200 Subject: [PATCH] Fixes for comments from PR #188 (#191) --- .../modules/source_control/gitlab/gitlab_user.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/modules/source_control/gitlab/gitlab_user.py b/plugins/modules/source_control/gitlab/gitlab_user.py index 25bc39d5b6..6e15c617f3 100644 --- a/plugins/modules/source_control/gitlab/gitlab_user.py +++ b/plugins/modules/source_control/gitlab/gitlab_user.py @@ -18,8 +18,8 @@ module: gitlab_user short_description: Creates/updates/deletes/blocks/unblocks GitLab Users description: - When the user does not exist in GitLab, it will be created. - - When the user does exists and state=absent, the user will be deleted. - - When the user does exists and state=blocked, the user will be blocked. + - When the user exists and state=absent, the user will be deleted. + - When the user exists and state=blocked, the user will be blocked. - When changes are made to user, the user will be updated. notes: - From Ansible 2.10 and onwards, name, email and password are optional while deleting the user. @@ -86,8 +86,7 @@ options: choices: ["guest", "reporter", "developer", "master", "maintainer", "owner"] state: description: - - create, delete or block a user. - - Possible values are present, absent, blocked, and unblocked. + - Create, delete or block a user. default: present type: str choices: ["present", "absent", "blocked", "unblocked"] @@ -116,7 +115,6 @@ EXAMPLES = ''' validate_certs: False username: myusername state: absent - delegate_to: localhost - name: "Create GitLab User" gitlab_user: @@ -133,7 +131,6 @@ EXAMPLES = ''' state: present group: super_group/mon_group access_level: owner - delegate_to: localhost - name: "Block GitLab User" gitlab_user: @@ -142,7 +139,6 @@ EXAMPLES = ''' validate_certs: False username: myusername state: blocked - delegate_to: localhost - name: "Unblock GitLab User" gitlab_user: @@ -151,7 +147,6 @@ EXAMPLES = ''' validate_certs: False username: myusername state: unblocked - delegate_to: localhost ''' RETURN = ''' @@ -490,7 +485,10 @@ def main(): gitlab_user = GitLabUser(module, gitlab_instance) user_exists = gitlab_user.existsUser(user_username) - user_is_active = gitlab_user.isActive(user_username) + if user_exists: + user_is_active = gitlab_user.isActive(user_username) + else: + user_is_active = False if state == 'absent': if user_exists: