cloud-init/cloud-init-0.7.6-groupadd-list.patch

32 lines
1.4 KiB
Diff

Index: cloud-init-0.7.6/cloudinit/distros/__init__.py
===================================================================
--- cloud-init-0.7.6.orig/cloudinit/distros/__init__.py
+++ cloud-init-0.7.6/cloudinit/distros/__init__.py
@@ -328,11 +328,16 @@ class Distro(object):
}
redact_opts = ['passwd']
+ # Options that are comma separated lists which we need to parse
+ list_stripped_opts = ['groups']
# Check the values and create the command
for key, val in kwargs.iteritems():
if key in adduser_opts and val and isinstance(val, str):
+ if key in list_stripped_opts:
+ values = [x.strip() for x in val.split(',')]
+ val = ','.join(values)
adduser_cmd.extend([adduser_opts[key], val])
# Redact certain fields from the logs
@@ -612,6 +617,9 @@ def _normalize_groups(grp_cfg):
raise TypeError("Bad group member type %s" %
type_utils.obj_name(v))
elif isinstance(i, (str, basestring)):
+ # Common to have leading whitespace in string lists,
+ # but not all useradd tools will support it.-
+ i = i.strip()
if i not in c_grp_cfg:
c_grp_cfg[i] = []
else: