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

[BUG] WALinuxAgent uses different distro version based on Python version #2715

Closed
jadeiceman opened this issue Dec 14, 2022 · 4 comments
Closed

Comments

@jadeiceman
Copy link

jadeiceman commented Dec 14, 2022

Only python 3.9 is available in CBL-Mariner 2.0, so instead of the full version string being detected, only the version ID is being returned. I suspect this is due to platform.linux_distribution() being removed in later versions of python, and the agent using distro.linux_distribution() instead, which doesn't return the full version string.

This is the content of /etc/os-release:

NAME="Common Base Linux Mariner"
VERSION="2.0.20221203"
ID=mariner
VERSION_ID="2.0"
PRETTY_NAME="CBL-Mariner/Linux"
ANSI_COLOR="1;34"
HOME_URL="https://aka.ms/cbl-mariner"
BUG_REPORT_URL="https://aka.ms/cbl-mariner"
SUPPORT_URL="https://aka.ms/cbl-mariner"

Log from Mariner 2.0 (returns only version ID):

2022-12-14T18:23:13.142860Z INFO Daemon Daemon Azure Linux Agent Version:2.3.1.1
2022-12-14T18:23:13.143986Z INFO Daemon Daemon OS: mariner 2.0
2022-12-14T18:23:13.144113Z INFO Daemon Daemon Python: 3.9.14
2022-12-14T18:23:13.144272Z INFO Daemon Daemon Run daemon
2022-12-14T18:23:13.144416Z INFO Daemon Daemon No RDMA handler exists for distro='Common Base Linux Mariner' version='2.0'

I expect 2.0.20221203 to be detected, but instead only 2.0 is detected.

Log from Mariner 1.0 (returns full version string using python 3.7):

2022-12-14T18:24:38.725096Z INFO Daemon Daemon Azure Linux Agent Version:2.2.54.2
2022-12-14T18:24:38.726342Z INFO Daemon Daemon OS: mariner 1.0.20221202
2022-12-14T18:24:38.726490Z INFO Daemon Daemon Python: 3.7.13
2022-12-14T18:24:38.726728Z INFO Daemon Daemon Run daemon
2022-12-14T18:24:38.726890Z INFO Daemon Daemon No RDMA handler exists for distro='CBL-Mariner' version='1.0.20221202'

Repro steps:

  1. Install WALinuxAgent on CBL-Mariner 2.0
  2. Start waagent service
  3. View logs

Distro and WALinuxAgent details:

  • Distro and Version: CBL-Mariner 2.0
  • WALinuxAgent version:
WALinuxAgent-2.3.1.1 running on mariner 2.0
Python: 3.9.14
Goal state agent: 2.3.1.1

Additional context
It may be better to use distro.distro_release_info() or distro.os_release_attr('version') instead to build osinfo.

Python 3.9.14 (main, Oct 29 2022, 22:18:10)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import distro
>>> distro.distro_release_info()
{'name': 'CBL-Mariner', 'version_id': '2.0.20221203', 'id': 'mariner'}
>>> distro.os_release_attr('version')
'2.0.20221203'
@nagworld9
Copy link
Contributor

It's been same case for other distros too with distro module. Any specific reason you are expecting full version rather major and minor version not enough?

@jadeiceman
Copy link
Author

We are tracking Mariner build versions in the backend to understand how much of the (Mariner) population is on different build versions. Security fixes are published to specific builds, so just the major version does not give us enough information. Without the full version, we can't tell how much of the population is still on older builds of the same major version.

@nagworld9
Copy link
Contributor

For this I wouldn't expect to take dependency on agent log to check the distro version.

@nagworld9
Copy link
Contributor

We fixed it and will roll out soon.

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

No branches or pull requests

2 participants