Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/check_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
run: |
git fetch --unshallow
git remote add upstream https://git.launchpad.net/cloud-init
- name: "Install Python 3.10"
- name: "Install Python 3.11.9"
uses: actions/setup-python@v5
with:
python-version: '3.11.9'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
unittests:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
toxenv: [py3]
slug: [""]
experimental: [false]
check-latest: [false]
continue-on-error: [false]
include:
- python-version: "3.8"
- python-version: "3.9"
toxenv: lowest-supported
slug: (lowest-supported)
continue-on-error: false
Expand Down
22 changes: 5 additions & 17 deletions cloudinit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,23 +584,11 @@ def get_linux_distro():
distro_name = platform.system().lower()
distro_version = platform.release()
else:
dist = ("", "", "")
try:
# Was removed in 3.8
dist = platform.dist() # type: ignore # pylint: disable=W1505,E1101
except Exception:
pass
finally:
found = None
for entry in dist:
if entry:
found = 1
if not found:
LOG.warning(
"Unable to determine distribution, template "
"expansion may have unexpected results"
)
return dist
LOG.warning(
"Unable to determine distribution, template "
"expansion may have unexpected results"
)
return "", "", ""

return (distro_name, distro_version, flavor)

Expand Down
7 changes: 4 additions & 3 deletions doc/rtd/development/contribute_code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ Cloud-init adheres to `PEP 8`_, and this is enforced by CI tests.
Python support
--------------

Cloud-init upstream currently supports Python 3.8 and above.
Cloud-init upstream currently supports Python 3.9 and above.

Cloud-init upstream will stay compatible with a particular Python version for 6
years after release. After 6 years, we will stop testing upstream changes
years after release. After that, upstream will stop testing upstream changes
against the unsupported version of Python and may introduce breaking changes.
This policy may change as needed.

The following table lists the cloud-init versions in which the minimum Python
version changed:
Expand All @@ -35,6 +34,8 @@ version changed:

* - Cloud-init version
- Python version
* - 25.4
- 3.9+
* - 24.3
- 3.8+
* - 22.1
Expand Down
7 changes: 1 addition & 6 deletions integration-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
#
pycloudlib>=1!10.0.2,<1!11

# Avoid breaking change in `testpaths` treatment forced
# test/unittests/conftest.py to be loaded by our integration-tests tox env
# resulting in an unmet dependency issue:
# https://github.com/pytest-dev/pytest/issues/11104
pytest!=7.3.2
pytest-timeout

# Even when xdist is not actively used, we have fixtures that require it
pytest-xdist

packaging
passlib
coverage==7.2.7 # Last version supported in Python 3.7
coverage
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ oauthlib
# that the built-in config parser is not sufficient (ie
# when we need to preserve comments, or do not have a top-level
# section)...
configobj>=5.0.2
configobj

# All new style configurations are in the yaml format
pyyaml
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# test/unittests/conftest.py to be loaded by our integration-tests tox env
# resulting in an unmet dependency issue:
# https://github.com/pytest-dev/pytest/issues/11104
pytest!=7.3.2
pytest

pytest-cov
pytest-mock
Expand Down
2 changes: 0 additions & 2 deletions tests/integration_tests/reaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
are reported to the end user as a test warning.
"""

from __future__ import annotations # required for Python 3.8

import logging
import queue
import threading
Expand Down
31 changes: 1 addition & 30 deletions tests/unittests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,42 +1299,13 @@ def test_get_linux_cos(self, m_os_release, m_path_exists):
assert ("cos", "93", "") == dist

@mock.patch("platform.system")
@mock.patch("platform.dist", create=True)
def test_get_linux_distro_no_data(
self, m_platform_dist, m_platform_system, m_path_exists
):
def test_get_linux_distro_no_data(self, m_platform_system, m_path_exists):
"""Verify we get no information if os-release does not exist"""
m_platform_dist.return_value = ("", "", "")
m_platform_system.return_value = "Linux"
m_path_exists.return_value = 0
dist = util.get_linux_distro()
assert ("", "", "") == dist

@mock.patch("platform.system")
@mock.patch("platform.dist", create=True)
def test_get_linux_distro_no_impl(
self, m_platform_dist, m_platform_system, m_path_exists
):
"""Verify we get an empty tuple when no information exists and
Exceptions are not propagated"""
m_platform_dist.side_effect = Exception()
m_platform_system.return_value = "Linux"
m_path_exists.return_value = 0
dist = util.get_linux_distro()
assert ("", "", "") == dist

@mock.patch("platform.system")
@mock.patch("platform.dist", create=True)
def test_get_linux_distro_plat_data(
self, m_platform_dist, m_platform_system, m_path_exists
):
"""Verify we get the correct platform information"""
m_platform_dist.return_value = ("foo", "1.1", "aarch64")
m_platform_system.return_value = "Linux"
m_path_exists.return_value = 0
dist = util.get_linux_distro()
assert ("foo", "1.1", "aarch64") == dist


class TestGetVariant:
@pytest.mark.parametrize(
Expand Down
26 changes: 12 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,22 @@ commands = coverage report -i
# dependencies will generally be older than what is found in pip.

# To obtain these versions, check the versions of these libraries
# in the oldest support Ubuntu distro. These versions are from bionic.
# in the oldest support Ubuntu distro. These versions are from Jammy.
deps =
jinja2==2.10.1
oauthlib==3.1.0
pyserial==3.4
jinja2==3.0.3
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this pinning. Validated against Jammy system packages.

oauthlib==3.2.0
pyserial==3.5
configobj==5.0.6
pyyaml==5.3.1
requests==2.22.0
jsonpatch==1.23
pyyaml==5.4.1
requests==2.25.1
jsonpatch==1.32.0
jsonschema==3.2.0
# test-requirements
pytest==4.6.9
pytest-cov==2.8.1
pytest-mock==1.10.4
responses==0.9.0
passlib
# required for this version of jinja2
markupsafe==2.0.1
pytest==6.2.5
pytest-cov==3.0.0
pytest-mock==3.6.1
responses==0.18.0
passlib==1.7.4
commands = {envpython} -m pytest -m "not hypothesis_slow" --cov=cloud-init --cov-branch {posargs:tests/unittests}

[testenv:doc]
Expand Down