From 50bbd72694156395a5af3726b410f80092256569 Mon Sep 17 00:00:00 2001 From: Andrea Tartaglia Date: Tue, 12 Nov 2019 21:01:53 +0000 Subject: [PATCH] gitlab_user: Fix ssh key add and group membership add when there's other changes (#63621) (#63634) * Fixed syntax in sshkey/group add * Added changelog * pep8 fix (cherry picked from commit b4bb3dee9aebf2491e88f0ee63a5f2e704827c50) --- .../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 0000000000..78e49c5e28 --- /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 cb730bfd07..43b8e68920 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: