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/__init__.py (+1/-1)
Reviewer Review Type Date Requested Status
Scott Moser Pending
Review via email: mp+312424@code.launchpad.net

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
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 4a72643..1f73195 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -403,7 +403,7 @@ class Distro(object):
403 # that can go right through to the command.403 # that can go right through to the command.
404 kwargs['groups'] = ",".join(groups)404 kwargs['groups'] = ",".join(groups)
405 else:405 else:
406 groups = groups.split(",")406 groups = [group.strip() for group in groups.split(",")]
407407
408 primary_group = kwargs.get('primary_group')408 primary_group = kwargs.get('primary_group')
409 if primary_group:409 if primary_group:

Subscribers

People subscribed via source and target branches