PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB` REDROOM
PHP 5.6.40
Preview: cc_ubuntu_autoinstall.py Size: 4.50 KB
//lib/python3.6/site-packages/cloudinit/config/cc_ubuntu_autoinstall.py

# This file is part of cloud-init. See LICENSE file for license information.

"""Autoinstall: Support ubuntu live-server autoinstall syntax."""

import logging
import re
from textwrap import dedent

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, 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__}",
                )
            ]
        )

Directory Contents

Dirs: 2 × Files: 64

Name Size Perms Modified Actions
schemas DIR
- drwxr-xr-x 2026-01-24 23:01:14
Edit Download
- drwxr-xr-x 2026-01-24 23:01:14
Edit Download
8.69 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
5.66 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
41.99 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
2.71 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
2.85 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
3.65 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
9.13 KB lrw-r--r-- 2026-01-23 08:56:46
Edit Download
13.77 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
2.03 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
32.36 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
3.02 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
3.39 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
21.03 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
6.65 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
3.81 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
2.38 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
3.61 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
5.31 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
1.86 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
18.14 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
6.10 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
3.49 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
19.71 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
20.84 KB lrw-r--r-- 2026-01-23 08:56:46
Edit Download
4.54 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
5.48 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
7.41 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
14.10 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
4.47 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
10.73 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
4.98 KB lrw-r--r-- 2026-01-23 08:56:46
Edit Download
16.97 KB lrw-r--r-- 2026-01-23 08:56:46
Edit Download
4.28 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
13.48 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
2.90 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
5.88 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
1.66 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
1.81 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
1.76 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
1.85 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
2.29 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
4.72 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
5.13 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
10.97 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
6.30 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
3.43 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
14.86 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
4.22 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
6.12 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
1.46 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
17.00 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
4.50 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
4.56 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
5.16 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
3.87 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
8.57 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
9.22 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
6.66 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
1.68 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
7.45 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
6.59 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
11.74 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
54.85 KB lrw-r--r-- 2023-12-04 11:47:40
Edit Download
14 B lrw-r--r-- 2023-12-04 11:47:40
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).
© 2026 REDROOM — Secure File Manager. All rights reserved. Built with ❤️ & Red Dark UI