cloud-init:24.1.x

Last commit made on 2024-04-29
Get this branch:
git clone -b 24.1.x https://git.launchpad.net/cloud-init
Members of cloud-init Commiters can upload to this branch. Log in for directions.

Branch merges

Branch information

Name:
24.1.x
Repository:
lp:cloud-init

Recent commits

c8d25d0... by Chad Smith

Release 24.1.5

Bump the version in cloudinit/version.py to 24.1.5 and
update ChangeLog.

13c1300... by Chad Smith

bug(package_update): avoid snap refresh in images without snap command

When package_update or package_upgrade: true are provided in
cloud-config do not call snap refresh on systems that do not have
the snap command.

This was intended as fixed in cbe5f3a119 but the fix only avoided
snap refresh during package install, not the generic package update
operation.

Fixes: GH-5143
LP: #2064132

3c8488d... by Chad Smith

Release 24.1.4

Bump the version in cloudinit/version.py to 24.1.4 and
update ChangeLog.

b0c7936... by Brett Holman

fix(dhcpcd): Make lease parsing more robust (#5129)

3d4213f... by Chris Patterson <email address hidden>

net/dhcp: raise InvalidDHCPLeaseFileError on error parsing dhcpcd lease (#5128)

Seeing a fairly large number of lease parsing failures on Azure similar
to:
```
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAzure.py", line 851, in _get_data
    crawled_data = util.log_time(
                   ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2828, in log_time
    ret = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/helpers/azure.py", line 45, in impl
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAzure.py", line 660, in crawl_metadata
    self._wait_for_pps_savable_reuse()
  File "/usr/lib/python3/dist-packages/cloudinit/sources/helpers/azure.py", line 45, in impl
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAzure.py", line 1236, in _wait_for_pps_savable_reuse
    self._wait_for_hot_attached_primary_nic(nl_sock)
  File "/usr/lib/python3/dist-packages/cloudinit/sources/helpers/azure.py", line 45, in impl
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAzure.py", line 1142, in _wait_for_hot_attached_primary_nic
    primary_nic_found = self._setup_ephemeral_networking(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/helpers/azure.py", line 45, in impl
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAzure.py", line 440, in _setup_ephemeral_networking
    lease = self._ephemeral_dhcp_ctx.obtain_lease()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/ephemeral.py", line 293, in obtain_lease
    self.lease = maybe_perform_dhcp_discovery(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 103, in maybe_perform_dhcp_discovery
    return distro.dhcp_client.dhcp_discovery(interface, dhcp_log_func, distro)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 656, in dhcp_discovery
    lease = self.get_newest_lease(interface)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 829, in get_newest_lease
    return self.parse_dhcpcd_lease(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 787, in parse_dhcpcd_lease
    lease = dict(
            ^^^^^
ValueError: dictionary update sequence element #0 has length 1; 2 is required
```

Catch this error in parse_dhcpcd_lease() and raise
InvalidDHCPLeaseFileError after logging an error.

Signed-off-by: Chris Patterson <email address hidden>

3bfd967... by Brett Holman

fix: Fix runtime file locations for cloud-init (#4820)

Update various hard-coded filepaths. Also make sure we
bootstrap our Paths() config correctly so that we read
from the configured rundir.

Co-authored-by: Mina Galić <email address hidden>
Sponsored by: The FreeBSD Foundation

Fixes GH-4766

de92c01... by Chris Patterson <email address hidden>

net/dhcp: bump dhcpcd timeout to 300s (#5127)

On most distros, including Ubuntu, the default timeout for dhclient is 300s.
There is no cloud-init controlled duration for the dhclient process as
it doesn't fork until after it receives an IP address and there is no timeout
value passed to subp().

I have seen some distros configure dhclient with a timeout of 60s, but
is far less common.

Given that a cloud VM is not very useful with DHCP, err on the generous
side and allow up to 300 seconds for dhcpcd to get an address.

Note that there is still an issue with dhcpcd retries which will be
addressed later in a separate PR.

Signed-off-by: Chris Patterson <email address hidden>

84c55be... by Brett Holman

net: Warn when interface rename fails

efd6ccc... by Brett Holman

ephemeral(dhcpcd): Set dhcpcd interface down

Address assignment and link management is manual for isc-dhcp-client
whereas dhcpcd brings up its own interface and assigns the IP address.

Interface rename code assumes that the link will be down for rename.
Make sure to set dhcpcd's interface to the same state.

739cd4c... by James Falcon

test: Remove side effects from tests (#5074)

These are the failures I could find when running tests in random order.
Changes that aren't self-explanatory should include a comment in the
test itself.

test_vultr.py includes a refactor to remove global state and remove
a test that didn't work and wasn't needed after the changes.