File fix-usermod-options-for-sle11-bsc-1117017-114.patch of Package salt

From 608aa5c728f8437f3c0903cb26142bb4db489582 Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@maryniuk.net>
Date: Mon, 29 Apr 2019 17:29:02 +0200
Subject: [PATCH] Fix usermod options for SLE11 (bsc#1117017) (#114)

* Fix usermod options for SLE11 (bsc#1117017)

* Fixes grain comparison

__grains__['osmajorrelease'] returns a string instead of a number.
---
 salt/modules/useradd.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/salt/modules/useradd.py b/salt/modules/useradd.py
index c723bb9bd3..dadd59462d 100644
--- a/salt/modules/useradd.py
+++ b/salt/modules/useradd.py
@@ -414,8 +414,14 @@ def chgroups(name, groups, append=False, root=None):
 
     if __grains__['kernel'] != 'OpenBSD':
         if append and __grains__['kernel'] != 'AIX':
-            cmd.append('-a')
-        cmd.append('-G')
+            if __grains__['osfullname'] == 'SLES' and __grains__['osmajorrelease'] == '11':
+                # SLE11 doesn't support "-a" and "-G" together with the for usermod
+                # See https://bugzilla.suse.com/show_bug.cgi?id=1117017
+                cmd.append('-A')
+            else:
+                cmd.append('-a')
+        if '-A' not in cmd:
+            cmd.append('-G')
     else:
         if append:
             cmd.append('-G')
-- 
2.20.1


openSUSE Build Service is sponsored by