Merge ~larsks/cloud-init:bug/1354694 into cloud-init:master

Proposed by Lars Kellogg-Stedman
Status: Merged
Merged at revision: cbf93eb4ae9fba0797ab4ae7d62bc0d64611fa7e
Proposed branch: ~larsks/cloud-init:bug/1354694
Merge into: cloud-init:master
Diff against target: 13 lines (+1/-1)
1 file modified
cloudinit/distros/ (+1/-1)
Reviewer Review Type Date Requested Status
Scott Moser Pending
Review via email:

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

I've re-opened the bug, unfortunately the change here didnt fix the issue all the way.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/distros/ b/cloudinit/distros/
2index 4a72643..1f73195 100755
3--- a/cloudinit/distros/
4+++ b/cloudinit/distros/
5@@ -403,7 +403,7 @@ class Distro(object):
6 # that can go right through to the command.
7 kwargs['groups'] = ",".join(groups)
8 else:
9- groups = groups.split(",")
10+ groups = [group.strip() for group in groups.split(",")]
12 primary_group = kwargs.get('primary_group')
13 if primary_group:


People subscribed via source and target branches