From cbf93eb4ae9fba0797ab4ae7d62bc0d64611fa7e Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Sat, 3 Dec 2016 21:29:45 -0500 Subject: 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 --- cloudinit/distros/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cloudinit/distros/__init__.py') 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: -- cgit v1.2.3