diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-08-22 23:48:23 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-08-22 23:48:23 -0400 |
commit | 55f6e4cb09d568d1a0679c41570b5c6d570a16f0 (patch) | |
tree | 9c10edc2a67205b72d5b1fdf4c77b0f4fd8508eb /cloudinit/config/cc_ssh_import_id.py | |
parent | 56979d20b9c56c45bfbcaf93bc5f93fa505ece50 (diff) | |
parent | bbbaeca0c375dc166ef8ffe0598d5f384b722c00 (diff) | |
download | vyos-cloud-init-55f6e4cb09d568d1a0679c41570b5c6d570a16f0.tar.gz vyos-cloud-init-55f6e4cb09d568d1a0679c41570b5c6d570a16f0.zip |
add support for creating initial users and groups
Added "userless" mode to cloud-init for handling the creation of the users
and the default user on Ubuntu. The end goal of this is to remove the need
for the 'ubuntu' user in the cloud images and to allow individuals to
choose the default user name.
LP: #1028503
Diffstat (limited to 'cloudinit/config/cc_ssh_import_id.py')
-rw-r--r-- | cloudinit/config/cc_ssh_import_id.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cloudinit/config/cc_ssh_import_id.py b/cloudinit/config/cc_ssh_import_id.py index c58b28ec..cd97b99b 100644 --- a/cloudinit/config/cc_ssh_import_id.py +++ b/cloudinit/config/cc_ssh_import_id.py @@ -25,14 +25,21 @@ from cloudinit import util distros = ['ubuntu'] -def handle(name, cfg, _cloud, log, args): +def handle(name, cfg, cloud, log, args): if len(args) != 0: user = args[0] ids = [] if len(args) > 1: ids = args[1:] else: - user = util.get_cfg_option_str(cfg, "user", "ubuntu") + user = cloud.distro.get_default_user() + + if 'users' in cfg: + user_zero = cfg['users'].keys()[0] + + if user_zero != "default": + user = user_zero + ids = util.get_cfg_option_list(cfg, "ssh_import_id", []) if len(ids) == 0: |