Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
121539b
fix(schema): Don't report changed keys as deprecated (#5464)
holmanb Jun 28, 2024
726159b
fix(test): Mock version boundary (#5464)
holmanb Jun 28, 2024
25669f7
fix: dont double-log deprecated INFOs (#5465)
TheRealFalcon Jun 28, 2024
5ce2ee3
chore: fix schema.py formatting (#5465)
TheRealFalcon Jun 28, 2024
0a698a5
test: Fix deprecation test failures (#5466)
TheRealFalcon Jun 28, 2024
7693ee2
tests: update keyserver PPA key fur curtin-dev (#5472)
blackboxsw Jul 1, 2024
d59724a
tests: integration tests aware of features.DEPRECATION_INFO_BOUNDARY
blackboxsw Jul 1, 2024
681b7de
fix(rh_subscription): add string type to org (#5453)
aciba90 Jul 1, 2024
ee1b25b
tests: update nocloud deprecation test for boundary version (#5474)
blackboxsw Jul 1, 2024
c45280e
tests: update ubuntu_pro test to account for info-level deprecations …
blackboxsw Jul 1, 2024
40e2eb4
test: Update integration tests to pass on focal (#5476)
TheRealFalcon Jul 1, 2024
41c375c
ci(mypy): Set default follow_imports value (#5350)
holmanb May 31, 2024
16018b2
fix(typing): Remove invalid type annotations (#5350)
holmanb Jun 1, 2024
5550285
fix(typing): Remove type annotation for unused variable (#5350)
holmanb Jun 1, 2024
a8cf24b
fix(typing): Add / update type annotations (#5350)
holmanb Jun 1, 2024
b26d388
refactor(typing): Remove unused code paths (#5350)
holmanb Jun 1, 2024
97146b5
chore(typing): Remove type ignores and casts (#5350)
holmanb Jun 1, 2024
e4c05e8
fix(tox): Update tox.ini (#5350)
holmanb Jun 3, 2024
73a5c51
chore: Auto-format network jsonschema in ci (#5350)
holmanb Jun 3, 2024
8ad0bba
type: Add stub types for network v1/v2 config (#5350)
holmanb Jun 10, 2024
c95ec1a
chore(mypy): Drop unused missing import exclusions (#5350)
holmanb Jun 21, 2024
2bca69a
fix(test): Fix ip printing for non-lxd instances (#5350)
holmanb Jul 1, 2024
291aabe
fix(test): Fix pycloudlib types in integration tests (#5350)
holmanb Jul 1, 2024
b0d6c7d
test: Add jsonschema guard in test_cc_ubuntu_pro.py (#5479)
TheRealFalcon Jul 2, 2024
0a7036e
fix: correct deprecated_version=22.2 for users.sudo
blackboxsw Jul 2, 2024
0a4c43d
test: Fix no default user in test_status.py (#5478)
TheRealFalcon Jul 2, 2024
fd63297
Release 24.2 (#5481)
TheRealFalcon Jul 3, 2024
359a195
update changelog
blackboxsw Jul 3, 2024
335e243
d/changelog: sync released changelog from focal-24.1.x branch
blackboxsw Jul 3, 2024
7a2163c
fix(systemd): drop unsupported CondtionEnvironment from hotplug
blackboxsw Jul 3, 2024
8c49112
merge from 24.2 at 24.2
blackboxsw Jul 3, 2024
ba16241
refresh patches against 24.2
blackboxsw Jul 3, 2024
99f7411
update changelog (new upstream snapshot)
blackboxsw Jul 3, 2024
f8dccc3
releasing cloud-init version 24.2-0ubuntu1~20.04.1
blackboxsw Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
364 changes: 364 additions & 0 deletions ChangeLog

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cloudinit/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Config = dict
Netv1 = dict
Netv2 = dict
4 changes: 1 addition & 3 deletions cloudinit/config/cc_lxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
} # type: ignore


def supplemental_schema_validation(
init_cfg: dict, bridge_cfg: dict, preseed_str: str
):
def supplemental_schema_validation(init_cfg, bridge_cfg, preseed_str):
"""Validate user-provided lxd network and bridge config option values.

@raises: ValueError describing invalid values provided.
Expand Down
8 changes: 4 additions & 4 deletions cloudinit/config/cc_power_state_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def check_condition(cond):

def handle(name: str, cfg: Config, cloud: Cloud, args: list) -> None:
try:
(args, timeout, condition) = load_power_state(cfg, cloud.distro)
if args is None:
(arg_list, timeout, condition) = load_power_state(cfg, cloud.distro)
if arg_list is None:
LOG.debug("no power_state provided. doing nothing")
return
except Exception as e:
Expand All @@ -99,7 +99,7 @@ def handle(name: str, cfg: Config, cloud: Cloud, args: list) -> None:

devnull_fp = open(os.devnull, "w")

LOG.debug("After pid %s ends, will execute: %s", mypid, " ".join(args))
LOG.debug("After pid %s ends, will execute: %s", mypid, " ".join(arg_list))

util.fork_cb(
run_after_pid_gone,
Expand All @@ -108,7 +108,7 @@ def handle(name: str, cfg: Config, cloud: Cloud, args: list) -> None:
timeout,
condition,
execmd,
[args, devnull_fp],
[arg_list, devnull_fp],
)


Expand Down
26 changes: 7 additions & 19 deletions cloudinit/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
from cloudinit.sources import DataSourceNotFoundException
from cloudinit.temp_utils import mkdtemp
from cloudinit.util import (
Version,
error,
get_modules_from_dir,
load_text_file,
load_yaml,
should_log_deprecation,
write_file,
)

Expand Down Expand Up @@ -127,7 +127,7 @@ class MetaSchema(TypedDict):
title: str
description: str
distros: typing.List[str]
examples: typing.List[str]
examples: typing.List[Union[dict, str]]
frequency: str
activate_by_schema_keys: NotRequired[List[str]]

Expand Down Expand Up @@ -362,7 +362,7 @@ def _validator(
):
"""Jsonschema validator for `deprecated` items.

It raises a instance of `error_type` if deprecated that must be handled,
It yields an instance of `error_type` if deprecated that must be handled,
otherwise the instance is consider faulty.
"""
if deprecated:
Expand Down Expand Up @@ -795,16 +795,14 @@ def validate_cloudconfig_schema(
if isinstance(
schema_error, SchemaDeprecationError
): # pylint: disable=W1116
if (
"devel" != features.DEPRECATION_INFO_BOUNDARY
and Version.from_str(schema_error.version)
> Version.from_str(features.DEPRECATION_INFO_BOUNDARY)
if schema_error.version == "devel" or should_log_deprecation(
schema_error.version, features.DEPRECATION_INFO_BOUNDARY
):
deprecations.append(SchemaProblem(path, schema_error.message))
else:
info_deprecations.append(
SchemaProblem(path, schema_error.message)
)
else:
deprecations.append(SchemaProblem(path, schema_error.message))
else:
errors.append(SchemaProblem(path, schema_error.message))

Expand Down Expand Up @@ -941,16 +939,6 @@ def annotate(
if not schema_errors and not schema_deprecations:
return self._original_content
lines = self._original_content.split("\n")
if not isinstance(self._cloudconfig, dict):
# Return a meaningful message on empty cloud-config
return "\n".join(
lines
+ [
self._build_footer(
"Errors", ["# E1: Cloud-config is not a YAML dict."]
)
]
)
errors_by_line = self._build_errors_by_line(schema_errors)
deprecations_by_line = self._build_errors_by_line(schema_deprecations)
annotated_content = self._annotate_content(
Expand Down
14 changes: 12 additions & 2 deletions cloudinit/config/schemas/schema-cloud-config-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2535,8 +2535,18 @@
"description": "The activation key to use. Must be used with ``org``. Should not be used with ``username`` or ``password``"
},
"org": {
"type": "integer",
"description": "The organization number to use. Must be used with ``activation-key``. Should not be used with ``username`` or ``password``"
"description": "The organization to use. Must be used with ``activation-key``. Should not be used with ``username`` or ``password``",
"oneOf": [
{
"type": "string"
},
{
"type": "integer",
"deprecated": true,
"deprecated_version": "24.2",
"deprecated_description": "Use of type integer for this value is deprecated. Use a string instead."
}
]
},
"auto-attach": {
"type": "boolean",
Expand Down
112 changes: 64 additions & 48 deletions cloudinit/config/schemas/schema-network-config-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,43 @@
]
},
"dhcp-overrides": {
"type": "object",
"description": "DHCP behaviour overrides. Overrides will only have an effect if the corresponding DHCP type is enabled.",
"additionalProperties": false,
"properties": {
"hostname": {
"type": "string",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
},
"route-metric": {
"type": "integer",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
},
"send-hostname": {
"type": "boolean",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
},
"use-dns": {
"type": "boolean"
},
"use-domains": {
"type": "string"
},
"use-hostname": {
"type": "boolean"
},
"use-mtu": {
"type": "boolean",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
},
"use-ntp": {
"type": "boolean"
},
"use-routes": {
"type": "boolean",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
}
"type": "object",
"description": "DHCP behaviour overrides. Overrides will only have an effect if the corresponding DHCP type is enabled.",
"additionalProperties": false,
"properties": {
"hostname": {
"type": "string",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
},
"route-metric": {
"type": "integer",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
},
"send-hostname": {
"type": "boolean",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
},
"use-dns": {
"type": "boolean"
},
"use-domains": {
"type": "string"
},
"use-hostname": {
"type": "boolean"
},
"use-mtu": {
"type": "boolean",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
},
"use-ntp": {
"type": "boolean"
},
"use-routes": {
"type": "boolean",
"description": "Unsupported for dhcp6-overrides when used with the networkd renderer."
}
}
},
"gateway": {
"type": "string",
Expand All @@ -56,17 +56,33 @@
"type": "object",
"properties": {
"renderer": {
"$ref": "#/$defs/renderer"
"$ref": "#/$defs/renderer"
},
"dhcp4": {
"type": ["boolean", "string"],
"type": [
"boolean",
"string"
],
"description": "Enable DHCP for IPv4. Off by default.",
"enum": ["yes", "no", true, false]
"enum": [
"yes",
"no",
true,
false
]
},
"dhcp6": {
"type": ["boolean", "string"],
"type": [
"boolean",
"string"
],
"description": "Enable DHCP for IPv6. Off by default.",
"enum": ["yes", "no", true, false]
"enum": [
"yes",
"no",
true,
false
]
},
"dhcp4-overrides": {
"$ref": "#/$defs/dhcp-overrides"
Expand All @@ -89,7 +105,7 @@
},
"mtu": {
"type": "integer",
"description": "The MTU key represents a device’s Maximum Transmission Unit, the largest size packet or frame, specified in octets (eight-bit bytes), that can be sent in a packet- or frame-based network. Specifying mtu is optional."
"description": "The MTU key represents a device\u2019s Maximum Transmission Unit, the largest size packet or frame, specified in octets (eight-bit bytes), that can be sent in a packet- or frame-based network. Specifying mtu is optional."
},
"nameservers": {
"type": "object",
Expand Down Expand Up @@ -152,7 +168,7 @@
},
"macaddress": {
"type": "string",
"description": "Device’s MAC address in the form xx:xx:xx:xx:xx:xx. Globs are not allowed. Letters must be lowercase."
"description": "Device\u2019s MAC address in the form xx:xx:xx:xx:xx:xx. Globs are not allowed. Letters must be lowercase."
},
"driver": {
"type": "string",
Expand All @@ -162,7 +178,7 @@
},
"set-name": {
"type": "string",
"description": "When matching on unique properties such as path or MAC, or with additional assumptions such as ''there will only ever be one wifi device'', match rules can be written so that they only match one device. Then this property can be used to give that device a more specific/desirable/nicer name than the default from udev’s ifnames. Any additional device that satisfies the match rules will then fail to get renamed and keep the original kernel name (and dmesg will show an error)."
"description": "When matching on unique properties such as path or MAC, or with additional assumptions such as ''there will only ever be one wifi device'', match rules can be written so that they only match one device. Then this property can be used to give that device a more specific/desirable/nicer name than the default from udev\u2019s ifnames. Any additional device that satisfies the match rules will then fail to get renamed and keep the original kernel name (and dmesg will show an error)."
},
"wakeonlan": {
"type": "boolean",
Expand Down Expand Up @@ -257,7 +273,7 @@
"description": "Configure how ARP replies are to be validated when using ARP link monitoring.",
"enum": [
"none",
"active",
"active",
"backup",
"all"
]
Expand Down Expand Up @@ -356,7 +372,7 @@
},
"stp": {
"type": "boolean",
"description": "Define whether the bridge should use Spanning Tree Protocol. The default value is “true”, which means that Spanning Tree should be used."
"description": "Define whether the bridge should use Spanning Tree Protocol. The default value is \u201ctrue\u201d, which means that Spanning Tree should be used."
}
}
}
Expand Down Expand Up @@ -393,13 +409,13 @@
]
},
"renderer": {
"$ref": "#/$defs/renderer"
"$ref": "#/$defs/renderer"
},
"ethernets": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/mapping_physical"
}
}
},
"bonds": {
"type": "object",
Expand Down
5 changes: 3 additions & 2 deletions cloudinit/distros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from cloudinit.distros.parsers import hosts
from cloudinit.features import ALLOW_EC2_MIRRORS_ON_NON_AWS_INSTANCE_TYPES
from cloudinit.net import activators, dhcp, renderers
from cloudinit.net.netops import NetOps
from cloudinit.net.network_state import parse_net_config_data
from cloudinit.net.renderer import Renderer

Expand Down Expand Up @@ -142,7 +143,7 @@ class Distro(persistence.CloudInitPickleMixin, metaclass=abc.ABCMeta):
# This is used by self.shutdown_command(), and can be overridden in
# subclasses
shutdown_options_map = {"halt": "-H", "poweroff": "-P", "reboot": "-r"}
net_ops = iproute2.Iproute2
net_ops: Type[NetOps] = iproute2.Iproute2

_ci_pkl_version = 1
prefer_fqdn = False
Expand Down Expand Up @@ -846,7 +847,7 @@ def create_user(self, name, **kwargs):
util.deprecate(
deprecated=f"The value of 'false' in user {name}'s "
"'sudo' config",
deprecated_version="22.3",
deprecated_version="22.2",
extra_message="Use 'null' instead.",
)

Expand Down
2 changes: 1 addition & 1 deletion cloudinit/distros/bsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BSD(distros.Distro):
# There is no update/upgrade on OpenBSD
pkg_cmd_update_prefix: Optional[List[str]] = None
pkg_cmd_upgrade_prefix: Optional[List[str]] = None
net_ops = bsd_netops.BsdNetOps # type: ignore
net_ops = bsd_netops.BsdNetOps

def __init__(self, name, cfg, paths):
super().__init__(name, cfg, paths)
Expand Down
4 changes: 3 additions & 1 deletion cloudinit/net/dhcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class NoDHCPLeaseMissingDhclientError(NoDHCPLeaseError):
"""Raised when unable to find dhclient."""


def maybe_perform_dhcp_discovery(distro, nic=None, dhcp_log_func=None):
def maybe_perform_dhcp_discovery(
distro, nic=None, dhcp_log_func=None
) -> Dict[str, Any]:
"""Perform dhcp discovery if nic valid and dhclient command exists.

If the nic is invalid or undiscoverable or dhclient command is not found,
Expand Down
4 changes: 2 additions & 2 deletions cloudinit/net/ephemeral.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ def __init__(
dhcp_log_func=None,
):
self.iface = iface
self._ephipv4 = None
self.lease = None
self._ephipv4: Optional[EphemeralIPv4Network] = None
self.lease: Optional[Dict[str, Any]] = None
self.dhcp_log_func = dhcp_log_func
self.connectivity_url_data = connectivity_url_data
self.distro = distro
Expand Down
Loading