diff options
author | Ben Howard <ben.howard@canonical.com> | 2012-08-20 14:52:31 -0600 |
---|---|---|
committer | Ben Howard <ben.howard@canonical.com> | 2012-08-20 14:52:31 -0600 |
commit | 336ddbe13bdfc729495f5bfb8cc89b4360916157 (patch) | |
tree | 3d551bde0b99b0db8c1c33f9bbd7e9e22acebb2f /cloudinit/config/cc_ssh_import_id.py | |
parent | 4540821caa31dc9ed0bedf521cd36975ddafebfa (diff) | |
download | vyos-cloud-init-336ddbe13bdfc729495f5bfb8cc89b4360916157.tar.gz vyos-cloud-init-336ddbe13bdfc729495f5bfb8cc89b4360916157.zip |
Added "userless" mode to cloud-init for handling the creation of the
users and the default user on Ubuntu.
cloudinit/config/cc_users_groups.py: new cloud-config module for creating
users and groups on instance initialization.
- Creates users and group
- Sets "user" directive used in ssh_import_id
cloudinit/config/cc_ssh_import_id.py: module will rely upon users_groups
for setting the default user. Removed assumption of 'ubuntu' user.
cloudinit/distros/__init__.py: Added new abstract methods for getting
and creating the default user.
cloudinit/distros/ubuntu.py: Defined abstract methods for getting and
and creating the default 'ubuntu' user on Ubuntu instances.
cloudinit/util.py: Added ability to hide command run through util.subp to
prevent the commands from showing in the logs. Used by user_groups
cloud-config module.
config/cloud.cfg: Removed "user: ubuntu" directive and replaced with new
user-less syntax.
doc/examples/cloud-config.txt: Documented the creation of users and groups.
Diffstat (limited to 'cloudinit/config/cc_ssh_import_id.py')
-rw-r--r-- | cloudinit/config/cc_ssh_import_id.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cloudinit/config/cc_ssh_import_id.py b/cloudinit/config/cc_ssh_import_id.py index c58b28ec..f18e1fc5 100644 --- a/cloudinit/config/cc_ssh_import_id.py +++ b/cloudinit/config/cc_ssh_import_id.py @@ -32,7 +32,12 @@ def handle(name, cfg, _cloud, log, args): if len(args) > 1: ids = args[1:] else: - user = util.get_cfg_option_str(cfg, "user", "ubuntu") + try: + user = cloud.distro.get_default_username() + except NotImplementedError: + pass + + user = None ids = util.get_cfg_option_list(cfg, "ssh_import_id", []) if len(ids) == 0: |