/snap/core18/2999/usr/lib/python3/dist-packages/cloudinit/config
NameSizeModeActions
schemas/-0755rm
__pycache__/-0755rm
cc_ansible.py85680644editdlrm
cc_apk_configure.py58830644editdlrm
cc_apt_configure.py332370644editdlrm
cc_apt_pipelining.py28880644editdlrm
cc_bootcmd.py29400644editdlrm
cc_byobu.py37570644editdlrm
cc_ca_certs.py82510644editdlrm
cc_chef.py141180644editdlrm
cc_disable_ec2_metadata.py20930644editdlrm
cc_disk_setup.py331150644editdlrm
cc_fan.py31840644editdlrm
cc_final_message.py34900644editdlrm
cc_growpart.py198900644editdlrm
cc_grub_dpkg.py56190644editdlrm
cc_install_hotplug.py39010644editdlrm
cc_keyboard.py21260644editdlrm
cc_keys_to_console.py37130644editdlrm
cc_landscape.py49760644editdlrm
cc_locale.py19230644editdlrm
cc_lxd.py183870644editdlrm
cc_mcollective.py63490644editdlrm
cc_migrator.py35990644editdlrm
cc_mounts.py194860644editdlrm
cc_ntp.py201720644editdlrm
cc_package_update_upgrade_install.py45300644editdlrm
cc_phone_home.py56360644editdlrm
cc_power_state_change.py78380644editdlrm
cc_puppet.py140660644editdlrm
cc_refresh_rmc_and_interface.py56140644editdlrm
cc_reset_rmc.py46420644editdlrm
cc_resizefs.py108180644editdlrm
cc_resolv_conf.py51300644editdlrm
cc_rh_subscription.py174560644editdlrm
cc_rightscale_userdata.py44070644editdlrm
cc_rsyslog.py100010644editdlrm
cc_runcmd.py29930644editdlrm
cc_salt_minion.py56680644editdlrm
cc_scripts_per_boot.py17170644editdlrm
cc_scripts_per_instance.py18730644editdlrm
cc_scripts_per_once.py18230644editdlrm
cc_scripts_user.py19130644editdlrm
cc_scripts_vendor.py23670644editdlrm
cc_seed_random.py49280644editdlrm
cc_set_hostname.py50120644editdlrm
cc_set_passwords.py113150644editdlrm
cc_snap.py65390644editdlrm
cc_spacewalk.py36040644editdlrm
cc_ssh.py143710644editdlrm
cc_ssh_authkey_fingerprints.py43380644editdlrm
cc_ssh_import_id.py59550644editdlrm
cc_timezone.py14750644editdlrm
cc_ubuntu_advantage.py172810644editdlrm
cc_ubuntu_autoinstall.py46720644editdlrm
cc_ubuntu_drivers.py47360644editdlrm
cc_update_etc_hosts.py52350644editdlrm
cc_update_hostname.py37210644editdlrm
cc_users_groups.py77870644editdlrm
cc_wireguard.py95070644editdlrm
cc_write_files.py69100644editdlrm
cc_write_files_deferred.py17180644editdlrm
cc_yum_add_repo.py76530644editdlrm
cc_zypper_add_repo.py68400644editdlrm
modules.py117000644editdlrm
schema.py441730644editdlrm
__init__.py140644editdlrm
Edit: /snap/core18/2999/usr/lib/python3/dist-packages/cloudinit/config/cc_ubuntu_autoinstall.py (4672B)
# This file is part of cloud-init. See LICENSE file for license information. """Autoinstall: Support ubuntu live-server autoinstall syntax.""" import re from logging import Logger from textwrap import dedent from cloudinit import log as logging from cloudinit.cloud import Cloud from cloudinit.config import Config from cloudinit.config.schema import ( MetaSchema, SchemaProblem, SchemaValidationError, get_meta_doc, ) from cloudinit.settings import PER_ONCE from cloudinit.subp import subp LOG = logging.getLogger(__name__) distros = ["ubuntu"] meta: MetaSchema = { "id": "cc_ubuntu_autoinstall", "name": "Ubuntu Autoinstall", "title": "Support Ubuntu live-server install syntax", "description": dedent( """\ Ubuntu's autoinstall YAML supports single-system automated installs in either the live-server install, via the ``subiquity`` snap, or the next generation desktop installer, via `ubuntu-desktop-install` snap. When "autoinstall" directives are provided in either ``#cloud-config`` user-data or ``/etc/cloud/cloud.cfg.d`` validate minimal autoinstall schema adherance and emit a warning if the live-installer is not present. The live-installer will use autoinstall directives to seed answers to configuration prompts during system install to allow for a "touchless" or non-interactive Ubuntu system install. For more details on Ubuntu's autoinstaller: https://ubuntu.com/server/docs/install/autoinstall """ ), "distros": distros, "examples": [ dedent( """\ # Tell the live-server installer to provide dhcp6 network config # and LVM on a disk matching the serial number prefix CT autoinstall: version: 1 network: version: 2 ethernets: enp0s31f6: dhcp6: yes storage: layout: name: lvm match: serial: CT* """ ) ], "frequency": PER_ONCE, "activate_by_schema_keys": ["autoinstall"], } __doc__ = get_meta_doc(meta) LIVE_INSTALLER_SNAPS = ("subiquity", "ubuntu-desktop-installer") def handle( name: str, cfg: Config, cloud: Cloud, log: Logger, args: list ) -> None: if "autoinstall" not in cfg: LOG.debug( "Skipping module named %s, no 'autoinstall' key in configuration", name, ) return snap_list, _ = subp(["snap", "list"]) installer_present = None for snap_name in LIVE_INSTALLER_SNAPS: if re.search(snap_name, snap_list): installer_present = snap_name if not installer_present: LOG.warning( "Skipping autoinstall module. Expected one of the Ubuntu" " installer snap packages to be present: %s", ", ".join(LIVE_INSTALLER_SNAPS), ) return validate_config_schema(cfg) LOG.debug( "Valid autoinstall schema. Config will be processed by %s", installer_present, ) def validate_config_schema(cfg): """Supplemental runtime schema validation for autoinstall yaml. Schema validation issues currently result in a warning log currently which can be easily ignored because warnings do not bubble up to cloud-init status output. In the case of the live-installer, we want cloud-init to raise an error to set overall cloud-init status to 'error' so it is more discoverable in installer environments. # TODO(Drop this validation When cloud-init schema is strict and errors) :raise: SchemaValidationError if any known schema values are present. """ autoinstall_cfg = cfg["autoinstall"] if not isinstance(autoinstall_cfg, dict): raise SchemaValidationError( [ SchemaProblem( "autoinstall", "Expected dict type but found:" f" {type(autoinstall_cfg).__name__}", ) ] ) if "version" not in autoinstall_cfg: raise SchemaValidationError( [SchemaProblem("autoinstall", "Missing required 'version' key")] ) elif not isinstance(autoinstall_cfg.get("version"), int): raise SchemaValidationError( [ SchemaProblem( "autoinstall.version", f"Expected int type but found:" f" {type(autoinstall_cfg['version']).__name__}", ) ] )