From b4bb3dee9aebf2491e88f0ee63a5f2e704827c50 Mon Sep 17 00:00:00 2001 From: Andrea Tartaglia Date: Thu, 17 Oct 2019 15:22:15 +0100 Subject: [PATCH] gitlab_user: Fix ssh key add and group membership add when there's other changes (#63621) * Fixed syntax in sshkey/group add * Added changelog * pep8 fix --- .../fragments/63621-gitlab_user-fix-sshkey-and-user.yml | 2 ++ lib/ansible/modules/source_control/gitlab_user.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/63621-gitlab_user-fix-sshkey-and-user.yml diff --git a/changelogs/fragments/63621-gitlab_user-fix-sshkey-and-user.yml b/changelogs/fragments/63621-gitlab_user-fix-sshkey-and-user.yml new file mode 100644 index 00000000000..78e49c5e282 --- /dev/null +++ b/changelogs/fragments/63621-gitlab_user-fix-sshkey-and-user.yml @@ -0,0 +1,2 @@ +bugfixes: +- "gitlab_user - Fix adding ssh key to new/changed user and adding group membership for new/changed user" diff --git a/lib/ansible/modules/source_control/gitlab_user.py b/lib/ansible/modules/source_control/gitlab_user.py index cb730bfd07e..43b8e689206 100644 --- a/lib/ansible/modules/source_control/gitlab_user.py +++ b/lib/ansible/modules/source_control/gitlab_user.py @@ -233,13 +233,15 @@ class GitLabUser(object): # Assign ssh keys if options['sshkey_name'] and options['sshkey_file']: - changed = changed or self.addSshKeyToUser(user, { + key_changed = self.addSshKeyToUser(user, { 'name': options['sshkey_name'], 'file': options['sshkey_file']}) + changed = changed or key_changed # Assign group if options['group_path']: - changed = changed or self.assignUserToGroup(user, options['group_path'], options['access_level']) + group_changed = self.assignUserToGroup(user, options['group_path'], options['access_level']) + changed = changed or group_changed self.userObject = user if changed: