From b04df23da2f35197f6b94aada9831602c0c8aad7 Mon Sep 17 00:00:00 2001 From: taksekine Date: Fri, 12 May 2017 05:59:39 +0900 Subject: [PATCH] fix #24429 (#24491) --- lib/ansible/modules/system/user.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index fb0754183d..4b73057934 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -2068,20 +2068,17 @@ class HPUX(User): if self.append: for g in groups: if g in group_diff: - if has_append: - cmd.append('-a') groups_need_mod = True break else: groups_need_mod = True if groups_need_mod: - if self.append and not has_append: - cmd.append('-A') - cmd.append(','.join(group_diff)) - else: - cmd.append('-G') - cmd.append(','.join(groups)) + cmd.append('-G') + new_groups = groups + if self.append: + new_groups = groups | set(current_groups) + cmd.append(','.join(new_groups)) if self.comment is not None and info[4] != self.comment: