From bc2df5bb40c12c5b813971c386d1a1af1c64f171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cosmin=20Lu=C8=9B=C4=83?= Date: Mon, 7 May 2012 18:08:50 +0300 Subject: [PATCH 1/4] Prevent facter stderr messages from confusing ansible --- facter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facter b/facter index a9cbf3006a2..6b8f2bad17a 100755 --- a/facter +++ b/facter @@ -22,4 +22,4 @@ # facter # ruby-json -/usr/bin/facter --json +/usr/bin/facter --json 2>/dev/null From 27b562fce896e9c4f8ffa3859a500ec54fb06cd4 Mon Sep 17 00:00:00 2001 From: Peter Sankauskas Date: Mon, 7 May 2012 11:35:45 -0700 Subject: [PATCH 2/4] Code was adding '-a' even when the user was already in the desired groups causing usermod to fail since there was no '-G' option. This is duplicate code (3 lines) from the 'group' section, so could be improved, but it works. --- user | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/user b/user index 30fdda21123..ce54faee22e 100755 --- a/user +++ b/user @@ -162,7 +162,10 @@ def user_mod(user, **kwargs): elif key == 'append': if kwargs[key] is not None and kwargs[key] == 'yes': if 'groups' in kwargs and kwargs['groups'] is not None: - cmd.append('-a') + defined_groups = kwargs['groups'].split(',') + existing_groups = user_group_membership(user) + if sorted(defined_groups) != sorted(existing_groups): + cmd.append('-a') # skip if no changes to be made if len(cmd) == 1: return False From 69fa870bb5067eb9fd2ad784ce93522750c96c1b Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 7 May 2012 20:05:10 -0400 Subject: [PATCH 3/4] Don't let facter spew things to stderr and confuse Ansible, which now blends stdout/stderr due to paramiko pty usage. (This commit from lcosmin, manually applied due to github crossup on my part -- MPD) --- facter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facter b/facter index a9cbf3006a2..6b8f2bad17a 100755 --- a/facter +++ b/facter @@ -22,4 +22,4 @@ # facter # ruby-json -/usr/bin/facter --json +/usr/bin/facter --json 2>/dev/null From 59f960101ea4309433ad5d133ba506ea7f5666ed Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 7 May 2012 20:07:12 -0400 Subject: [PATCH 4/4] Reverting to apply correct attribution. --- facter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facter b/facter index 6b8f2bad17a..a9cbf3006a2 100755 --- a/facter +++ b/facter @@ -22,4 +22,4 @@ # facter # ruby-json -/usr/bin/facter --json 2>/dev/null +/usr/bin/facter --json