Skip to content

Commit

Permalink
Version: 23.4.4-0ubuntu0~20.04.1
Browse files Browse the repository at this point in the history
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 3.0 (quilt)
Source: cloud-init
Binary: cloud-init
Architecture: all
Version: 23.4.4-0ubuntu0~20.04.1
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Homepage: https://cloud-init.io/
Standards-Version: 4.4.1
Vcs-Browser: https://github.com/canonical/cloud-init/tree/ubuntu/devel
Vcs-Git: https://github.com/canonical/cloud-init -b ubuntu/devel
Build-Depends: debhelper (>= 9.20160709), dh-python, iproute2, po-debconf, python3, python3-configobj, python3-debconf, python3-jinja2, python3-jsonpatch, python3-jsonschema, python3-mock, python3-netifaces, python3-oauthlib, python3-pytest, python3-pytest-mock, python3-requests, python3-serial, python3-setuptools, python3-yaml, python3-responses, python3-passlib
Package-List:
 cloud-init deb admin optional arch=all
Checksums-Sha1:
 e9d2d65539568f9abc9b22666a84e228240ed11d 1760462 cloud-init_23.4.4.orig.tar.gz
 ef6993da1599626372c30e50c4f2dce95a44ca20 93196 cloud-init_23.4.4-0ubuntu0~20.04.1.debian.tar.xz
Checksums-Sha256:
 ffedd8c1c80c765e64ba99a49dd92150f2a51214bf16ee52c15f4dbf6522049b 1760462 cloud-init_23.4.4.orig.tar.gz
 d8984b489862b9afef31e7d23aa74aaa1bfc848ace3b613ffbd1f14d05e24eca 93196 cloud-init_23.4.4-0ubuntu0~20.04.1.debian.tar.xz
Files:
 8002d8faa3b71e20977df344ea714296 1760462 cloud-init_23.4.4.orig.tar.gz
 46b3d615c7a8383d21df368fb0d46f1a 93196 cloud-init_23.4.4-0ubuntu0~20.04.1.debian.tar.xz
Python-Version: all

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE4lRR4CIbV3Pev/F47NrLFgmVrYkFAmXeZN4ACgkQ7NrLFgmV
rYnKQA//Sf9l84646aXFsPmAj2NtbUQPZP7OgZprTfoLn9SHiLRvXYaMuRpSom1S
PKN/twrxc/PN48HQh0gVc7RESbWtxO5vZuuvHvF1gCe824vdjv1APTLjFguIxjYx
MDqtuKAK2fh1R/f1SuOBqsmb8zwFCjCNt9Eu3ZpajQbxZMkTvitMRGqwbyAB97qY
Ts0c6+gDNwD/3wmFDVvZquQEoZUWQFXyNpAVYuN6LTFT4x8g8NTD1Z06kLzO+7/7
lCrHkfCIMU7F2fCHByuUFsGaqabM5WhRxnbx79JM4E97qsoajAByWI7ifeEf/sA2
otNVk8A18rGPn7+36KTzGrJG3R/URqWSrzZdOd4JicT9xfp2u7WtHDVXs9XcE0Gs
QqaL51N8TKxRJMq/gs7mJU+Hp1xT3G+SVQFBXOOXmGKnp+0HmvV9oshX5NrdkW6F
j4t2/Z+d7kSj3rn75gGcAumlWJD+ckqA+RN594BuwIpL6Lw3RXpAjt9NVMTz9wnc
756PoYRzJMEvh2p8+29Pq9vlpl5h7TQGAFC4BlE/799SLVy3tk0bG6YKBJKEafiY
V7XF10HsmTBVK80BlIsWsZdHP6GpL286IDEvydWzCkD+YhPB9lVAQjznzHQ5u/H/
Qb8e22VoABjDgtICxQ6+hITgMattwg/CXtnQsPlZSfgD9BFXaTw=
=eVuf
-----END PGP SIGNATURE-----
  • Loading branch information
Delphix Engineering committed Mar 2, 2024
1 parent 6bb790b commit ad10748
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 10 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
23.4.4
- fix(nocloud): smbios datasource definition
- tests: Check that smbios seed works
- fix(source): fix argument boundaries when parsing cmdline (#4825)

23.4.3
- fix: Handle systemctl when dbus not ready (#4842)
(LP: #2046483)
Expand Down
39 changes: 34 additions & 5 deletions cloudinit/sources/DataSourceNoCloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import errno
import logging
import os
from functools import partial

from cloudinit import dmi, sources, util
from cloudinit.net import eni
Expand Down Expand Up @@ -368,12 +369,40 @@ def __init__(self, sys_cfg, distro, paths):
self.supported_seed_starts = ("http://", "https://")

def ds_detect(self):
"""NoCloud requires "nocloud-net" as the way to specify
seeding from an http(s) address. This diverges from all other
datasources in that it does a kernel commandline match on something
other than the datasource dsname for only DEP_NETWORK.
"""Check dmi and kernel commandline for dsname
NoCloud historically used "nocloud-net" as its dsname
for network timeframe (DEP_NETWORK), which supports http(s) urls.
For backwards compatiblity, check for that dsname.
"""
return "nocloud-net" == sources.parse_cmdline()
log_deprecated = partial(
util.deprecate,
deprecated="The 'nocloud-net' datasource name",
deprecated_version="24.1",
extra_message=(
"Use 'nocloud' instead, which uses the seedfrom protocol"
"scheme (http// or file://) to decide how to run."
),
)

if "nocloud-net" == sources.parse_cmdline():
log_deprecated()
return True

serial = sources.parse_cmdline_or_dmi(
dmi.read_dmi_data("system-serial-number") or ""
).lower()

if serial in (self.dsname.lower(), "nocloud-net"):
LOG.debug(
"Machine is configured by dmi serial number to run on "
"single datasource %s.",
self,
)
if serial == "nocloud-net":
log_deprecated()
return True
return False


# Used to match classes to dependencies
Expand Down
11 changes: 7 additions & 4 deletions cloudinit/sources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,10 +1184,13 @@ def parse_cmdline() -> str:
"""Check if command line argument for this datasource was passed
Passing by command line overrides runtime datasource detection
"""
cmdline = util.get_cmdline()
ds_parse_0 = re.search(r"ds=([^\s;]+)", cmdline)
ds_parse_1 = re.search(r"ci\.ds=([^\s;]+)", cmdline)
ds_parse_2 = re.search(r"ci\.datasource=([^\s;]+)", cmdline)
return parse_cmdline_or_dmi(util.get_cmdline())


def parse_cmdline_or_dmi(input: str) -> str:
ds_parse_0 = re.search(r"(?:^|\s)ds=([^\s;]+)", input)
ds_parse_1 = re.search(r"(?:^|\s)ci\.ds=([^\s;]+)", input)
ds_parse_2 = re.search(r"(?:^|\s)ci\.datasource=([^\s;]+)", input)
ds = ds_parse_0 or ds_parse_1 or ds_parse_2
deprecated = ds_parse_1 or ds_parse_2
if deprecated:
Expand Down
2 changes: 1 addition & 1 deletion cloudinit/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# This file is part of cloud-init. See LICENSE file for license information.

__VERSION__ = "23.4.3"
__VERSION__ = "23.4.4"
_PACKAGED_VERSION = "@@PACKAGED_VERSION@@"

FEATURES = [
Expand Down
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
cloud-init (23.4.4-0ubuntu0~20.04.1) focal; urgency=medium

* Upstream snapshot based on 23.4.4. (LP: #2055081).
List of changes from upstream can be found at
https://raw.githubusercontent.com/canonical/cloud-init/23.4.4/ChangeLog

-- Chad Smith <chad.smith@canonical.com> Tue, 27 Feb 2024 08:13:27 -0700

cloud-init (23.4.3-0ubuntu0~20.04.1) focal; urgency=medium

* Upstream snapshot based on 23.4.3. (LP: #2046483).
Expand Down
101 changes: 101 additions & 0 deletions tests/integration_tests/datasources/test_nocloud.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""NoCloud datasource integration tests."""
from textwrap import dedent

import pytest
from pycloudlib.lxd.instance import LXDInstance

Expand Down Expand Up @@ -88,3 +90,102 @@ def test_nocloud_seedfrom_vendordata(client: IntegrationInstance):
client.restart()
assert client.execute("cloud-init status").ok
assert "seeded_vendordata_test_file" in client.execute("ls /var/tmp")


SMBIOS_USERDATA = """\
#cloud-config
runcmd:
- touch /var/tmp/smbios_test_file
"""
SMBIOS_SEED_DIR = "/smbios_seed"


def setup_nocloud_local_serial(instance: LXDInstance):
subp(
[
"lxc",
"config",
"set",
instance.name,
"raw.qemu=-smbios "
f"type=1,serial=ds=nocloud;s=file://{SMBIOS_SEED_DIR};h=myhost",
]
)


def setup_nocloud_network_serial(instance: LXDInstance):
subp(
[
"lxc",
"config",
"set",
instance.name,
"raw.qemu=-smbios "
"type=1,serial=ds=nocloud-net;s=http://0.0.0.0/;h=myhost",
]
)


@pytest.mark.lxd_use_exec
@pytest.mark.skipif(
PLATFORM != "lxd_vm",
reason="Requires NoCloud with raw QEMU serial setup",
)
class TestSmbios:
@pytest.mark.lxd_setup.with_args(setup_nocloud_local_serial)
def test_smbios_seed_local(self, client: IntegrationInstance):
"""Check that smbios seeds that use local disk work"""
assert client.execute(f"mkdir -p {SMBIOS_SEED_DIR}").ok
client.write_to_file(f"{SMBIOS_SEED_DIR}/user-data", SMBIOS_USERDATA)
client.write_to_file(f"{SMBIOS_SEED_DIR}/meta-data", "")
client.write_to_file(f"{SMBIOS_SEED_DIR}/vendor-data", "")
assert client.execute("cloud-init clean --logs").ok
client.restart()
assert client.execute("test -f /var/tmp/smbios_test_file").ok

@pytest.mark.lxd_setup.with_args(setup_nocloud_network_serial)
def test_smbios_seed_network(self, client: IntegrationInstance):
"""Check that smbios seeds that use network (http/https) work"""
service_file = "/lib/systemd/system/local-server.service"
client.write_to_file(
service_file,
dedent(
"""\
[Unit]
Description=Serve a local webserver
Before=cloud-init.service
Wants=cloud-init-local.service
DefaultDependencies=no
After=systemd-networkd-wait-online.service
After=networking.service
[Install]
WantedBy=cloud-init.target
[Service]
"""
f"WorkingDirectory={SMBIOS_SEED_DIR}"
"""
ExecStart=/usr/bin/env python3 -m http.server --bind 0.0.0.0 80
"""
),
)
assert client.execute(
"chmod 644 /lib/systemd/system/local-server.service"
).ok
assert client.execute("systemctl enable local-server.service").ok
client.write_to_file(
"/etc/cloud/cloud.cfg.d/91_do_not_use_lxd.cfg",
"datasource_list: [ NoCloud, None ]\n",
)
assert client.execute(f"mkdir -p {SMBIOS_SEED_DIR}").ok
client.write_to_file(f"{SMBIOS_SEED_DIR}/user-data", SMBIOS_USERDATA)
client.write_to_file(f"{SMBIOS_SEED_DIR}/meta-data", "")
client.write_to_file(f"{SMBIOS_SEED_DIR}/vendor-data", "")
assert client.execute("cloud-init clean --logs").ok
client.restart()
assert client.execute("test -f /var/tmp/smbios_test_file").ok
assert "'nocloud-net' datasource name is deprecated" in client.execute(
"cloud-init status --format json"
)
7 changes: 7 additions & 0 deletions tests/unittests/sources/test___init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
("aosiejfoij ci.ds=OpenStack faljskebflk", openstack_ds_name),
("ci.ds=OpenStack;", openstack_ds_name),
("ci.ds=openstack;", openstack_ds_name),
("notci.ds=somecloud ci.ds=openstack", openstack_ds_name),
# test ci.datasource=
("aosiejfoij ci.datasource=OpenStack ", openstack_ds_name),
("ci.datasource=OpenStack", openstack_ds_name),
("aosiejfoij ci.datasource=OpenStack blah", openstack_ds_name),
("aosiejfoij ci.datasource=OpenStack faljskebflk", openstack_ds_name),
("ci.datasource=OpenStack;", openstack_ds_name),
("ci.datasource=openstack;", openstack_ds_name),
("notci.datasource=0 ci.datasource=nocloud", "nocloud"),
# weird whitespace
("ci.datasource=OpenStack\n", openstack_ds_name),
("ci.datasource=OpenStack\t", openstack_ds_name),
Expand All @@ -35,6 +37,11 @@
("ci.ds=OpenStack\v", openstack_ds_name),
("ci.ds=nocloud-net\v", "nocloud-net"),
("ci.datasource=nocloud\v", "nocloud"),
# test ds=
("ds=nocloud-net", "nocloud-net"),
("foo ds=nocloud-net bar", "nocloud-net"),
("bonding.max_bonds=0", ""),
("foo bonding.max_bonds=0 ds=nocloud-net bar", "nocloud-net"),
),
)
def test_ds_detect_kernel_commandline(m_cmdline, expected_ds):
Expand Down
1 change: 1 addition & 0 deletions tools/.github-cla-signers
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ frantisekz
GabrielNagy
garzdin
giggsoff
gilbsgilbs
glyg
hamalq
holmanb
Expand Down

0 comments on commit ad10748

Please sign in to comment.