summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/distros/__init__.py2
-rw-r--r--tests/unittests/test_distros/test_user_data_normalize.py11
2 files changed, 13 insertions, 0 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 4fb1d8c2..361d2c05 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -338,6 +338,8 @@ class Distro(object):
raise TypeError(("Unmappable user value type %s"
" for key %s") % (util.obj_name(v), k))
u_cfg = ad_ucfg
+ elif isinstance(u_cfg, (str, basestring)):
+ u_cfg = u_cfg.strip().split(",")
users = {}
for user_config in u_cfg:
diff --git a/tests/unittests/test_distros/test_user_data_normalize.py b/tests/unittests/test_distros/test_user_data_normalize.py
index 6ff43a76..caf479cd 100644
--- a/tests/unittests/test_distros/test_user_data_normalize.py
+++ b/tests/unittests/test_distros/test_user_data_normalize.py
@@ -112,6 +112,17 @@ class TestUGNormalize(MockerTestCase):
((users, def_user), groups) = distro.normalize_users_groups(ug_cfg)
self.assertEquals({}, def_user)
+ def test_users_simple_csv(self):
+ distro = self._make_distro('ubuntu')
+ ug_cfg = {
+ 'users': 'joe,bob',
+ }
+ ((users, def_user), groups) = distro.normalize_users_groups(ug_cfg)
+ self.assertIn('joe', users)
+ self.assertIn('bob', users)
+ self.assertEquals({}, users['joe'])
+ self.assertEquals({}, users['bob'])
+
def test_users_simple(self):
distro = self._make_distro('ubuntu')
ug_cfg = {