Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update supported Ubuntu versions #2980

Merged
merged 1 commit into from
Nov 20, 2023
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
11 changes: 5 additions & 6 deletions azurelinuxagent/common/osutil/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name)
return ClearLinuxUtil()

if distro_name == "ubuntu":
if Version(distro_version) in [Version("12.04"), Version("12.10")]:
ubuntu_version = Version(distro_version)
if ubuntu_version in [Version("12.04"), Version("12.10")]:
return Ubuntu12OSUtil()
if Version(distro_version) in [Version("14.04"), Version("14.10")]:
if ubuntu_version in [Version("14.04"), Version("14.10")]:
return Ubuntu14OSUtil()
if Version(distro_version) in [Version('16.04'), Version('16.10'), Version('17.04')]:
if ubuntu_version in [Version('16.04'), Version('16.10'), Version('17.04')]:
return Ubuntu16OSUtil()
if Version(distro_version) in [Version('18.04'), Version('18.10'),
Version('19.04'), Version('19.10'),
Version('20.04')]:
if ubuntu_version >= Version('18.04') and ubuntu_version <= Version('24.04'):
return Ubuntu18OSUtil()
if distro_full_name == "Snappy Ubuntu Core":
return UbuntuSnappyOSUtil()
Expand Down
2 changes: 1 addition & 1 deletion azurelinuxagent/common/osutil/ubuntu.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def unregister_agent_service(self):

class Ubuntu18OSUtil(Ubuntu16OSUtil):
"""
Ubuntu 18.04, 18.10, 19.04, 19.10, 20.04
Ubuntu >=18.04 and <=24.04
"""
def __init__(self):
super(Ubuntu18OSUtil, self).__init__()
Expand Down
7 changes: 7 additions & 0 deletions tests/common/osutil/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ def test_get_osutil_it_should_return_ubuntu(self):
self.assertTrue(isinstance(ret, Ubuntu18OSUtil))
self.assertEqual(ret.get_service_name(), "walinuxagent")

ret = _get_osutil(distro_name="ubuntu",
distro_code_name="focal",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi, while checking the patches we carry on, I discovered that this should be "noble", not "focal"... I can open an MP/issue for this, but I am making a note here not to forget it.

distro_version="24.04",
distro_full_name="")
self.assertTrue(isinstance(ret, Ubuntu18OSUtil))
self.assertEqual(ret.get_service_name(), "walinuxagent")

ret = _get_osutil(distro_name="ubuntu",
distro_code_name="",
distro_version="10.04",
Expand Down
Loading