diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-09-24 20:45:56 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-09-24 20:45:56 -0700 |
commit | 12495e3e597541ad411a656c980b9e405c2a902d (patch) | |
tree | e79bbbbd70e1ca8e0e77c69687be152e0bd4fd1a /cloudinit | |
parent | a2c6279d303a3b85625404653c7ab8081281ee18 (diff) | |
download | vyos-cloud-init-12495e3e597541ad411a656c980b9e405c2a902d.tar.gz vyos-cloud-init-12495e3e597541ad411a656c980b9e405c2a902d.zip |
Avoid rechecking if old users is availabile.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/distros/__init__.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 4cf8f745..f07ba3fa 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -529,19 +529,19 @@ def normalize_users_groups(cfg, distro): LOG.warn(("Distro has not implemented default user " "access. No default user will be normalized.")) base_users = cfg['users'] - if isinstance(base_users, (list)): - if len(base_users) and old_user: - # The old user replaces user[0] - base_users[0] = {'name': old_user} - elif not base_users and old_user: - base_users.append({'name': old_user}) - elif isinstance(base_users, (dict)): - # Sorry order not possible - if old_user and old_user not in base_users: - base_users[old_user] = True - elif isinstance(base_users, (str, basestring)): - # Just append it on to be re-parsed later - if old_user: + if old_user: + if isinstance(base_users, (list)): + if len(base_users): + # The old user replaces user[0] + base_users[0] = {'name': old_user} + else: + # Just add it on at the end... + base_users.append({'name': old_user}) + elif isinstance(base_users, (dict)): + if old_user not in base_users: + base_users[old_user] = True + elif isinstance(base_users, (str, basestring)): + # Just append it on to be re-parsed later base_users += ",%s" % (old_user) users = _normalize_users(base_users, default_user_config) return (users, groups) |