diff options
author | Lars Kellogg-Stedman <lars@redhat.com> | 2016-12-03 21:29:45 -0500 |
---|---|---|
committer | Lars Kellogg-Stedman <lars@redhat.com> | 2016-12-03 21:33:50 -0500 |
commit | cbf93eb4ae9fba0797ab4ae7d62bc0d64611fa7e (patch) | |
tree | 1b1349ae230e889718e420ce3f2b10ded7aa9c09 /cloudinit/distros | |
parent | 166df605dc9864eb163007300db7a611feb309d6 (diff) | |
download | vyos-cloud-init-cbf93eb4ae9fba0797ab4ae7d62bc0d64611fa7e.tar.gz vyos-cloud-init-cbf93eb4ae9fba0797ab4ae7d62bc0d64611fa7e.zip |
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
Diffstat (limited to 'cloudinit/distros')
-rwxr-xr-x | cloudinit/distros/__init__.py | 2 |
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: |