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

support ubuntu24.04 with python3.12 #1964

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcurdy
Copy link

Supporting Python3.12 requires adding "r" for raw in regexes and replacing platform for module distro. This change needs to be tested on FreeBSD. Additionally, to allow ubuntu 24.04 to work, the supported distros list was expanded.

@marcurdy
Copy link
Author

Getting corporate approval

@marcurdy
Copy link
Author

I have checked with my legal team.
@microsoft-github-policy-service agree [company=""]
@microsoft-github-policy-service agree
@microsoft-github-policy-service agree company="Microsoft"

@marcurdy
Copy link
Author

@microsoft-github-policy-service agree
@microsoft-github-policy-service agree company="Accenture"

@gilbahat
Copy link

@nkuchta @D1v38om83r Hi, this is really important for us as ubuntu 24.04 blocked from using azure monitor features.

@@ -39,6 +39,7 @@
import hashlib
import fileinput
import contextlib
import distro

Choose a reason for hiding this comment

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

Sorry for the drive-by comments @marcurdy - I don't work on this project but I would like to get this issue resolved so my team can use Ubuntu 24.04 hosts on Azure without issue!

distro is a third-party package, and from what I can see in the way that this AzureMonitorAgent project is set up, the project has no requirements.txt / setup.py or any other mechanism to declare third-party dependencies. So I think this is intended to be deployed as just a single script, and adding a third-party dep will not work?

Copy link

Choose a reason for hiding this comment

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

on my ubuntu 24.04, distro comes ootb even in minimized installations. IMHO dropping it would be wrong, but it would be prudent to put it behind a try clause.

Choose a reason for hiding this comment

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

@gilbahat cool, good to know. a try/except sounds appropriate here. When I get a chance this week I can do some tests with Docker to see whether major distributions include this library out of the box.

@@ -1651,12 +1652,11 @@ def find_vm_distro(operation):
# platform commands used below aren't available after Python 3.6
if sys.version_info < (3,7):
try:
vm_dist, vm_ver, vm_id = platform.linux_distribution()
vm_dist = distro.id()

Choose a reason for hiding this comment

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

since you're adding fixes for Python 3.12 and higher, I'd leave this branch alone that was meant for Python <3.7

@@ -1651,12 +1652,11 @@ def find_vm_distro(operation):
# platform commands used below aren't available after Python 3.6

Choose a reason for hiding this comment

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

This comment and check seem wrong actually - platform.dist and platform.linux_distribution were documented in Python 3.7 and removed in Python 3.8.

@@ -47,6 +47,7 @@ import zipfile
import json
import datetime
import xml.sax.saxutils
import distro

Choose a reason for hiding this comment

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

Same comment as above - waagent seems to be set up to be a single file script, so I don't think third-party dependencies would be allowed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants