From dac59c13424e403f73e3cad46e7412482b17f92a Mon Sep 17 00:00:00 2001
From: Kai Kang <kai.kang@windriver.com>
Date: Thu, 6 Aug 2020 17:09:25 +0800
Subject: [PATCH] Fix kickstart file error with user groups

When fill the "Group Membership" in "ADVANCED USER CONFIGURATION"
dialog with the provided example text:

wheel, my-team (1245), project-x (29935)

It keeps the spaces between group name(project-x) and group id('(29935)'),
and then write them to kickstart file. When boot anaconda with the kickstart
file, it fails with:

| unrecognzed arguments: (1245),project-x (29935)

Filter out the spaces between group name and group id to avoid such
issue.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 pyanaconda/ui/gui/spokes/user.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index 82fbdc8f8..05e01f8a6 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -157,7 +157,7 @@ class AdvancedUserDialog(GUIObject, GUIDialogInputCheckHandler):
             self.user.gid = USER_GID_NOT_SET
 
         # ''.split(',') returns [''] instead of [], which is not what we want
-        self.user.groups = [g.strip() for g in self._tGroups.get_text().split(",") if g]
+        self.user.groups = [''.join(g.split()) for g in self._tGroups.get_text().split(",") if g]
 
         # Send ready signal to main event loop
         hubQ.send_ready(self.__class__.__name__, False)
-- 
2.23.0

