summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Kellogg-Stedman <lars@redhat.com>2016-12-03 21:29:45 -0500
committerLars Kellogg-Stedman <lars@redhat.com>2016-12-03 21:33:50 -0500
commitcbf93eb4ae9fba0797ab4ae7d62bc0d64611fa7e (patch)
tree1b1349ae230e889718e420ce3f2b10ded7aa9c09
parent166df605dc9864eb163007300db7a611feb309d6 (diff)
downloadcloud-init-git-cbf93eb4ae9fba0797ab4ae7d62bc0d64611fa7e.tar.gz
when adding a user, strip whitespace from group list
The documentation shows group names in the 'groups:' key delimited by ", ", but this will result in group names that contain spaces. This can cause the 'groupadd' or 'useradd' commands to fail. This patch ensures that we strip whitespace from either end of the group names passed to the 'groups:' key. LP: #1354694
-rwxr-xr-xcloudinit/distros/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 4a726430..1f731951 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -403,7 +403,7 @@ class Distro(object):
# that can go right through to the command.
kwargs['groups'] = ",".join(groups)
else:
- groups = groups.split(",")
+ groups = [group.strip() for group in groups.split(",")]
primary_group = kwargs.get('primary_group')
if primary_group: