Fix python version module compatible (TEAM-11049)#311
Conversation
8608f82 to
1d6bfa6
Compare
|
LGTM, thanks |
| # Get version from /etc/os-release | ||
| test_version = ssh.ssh.exec_command("grep VERSION= /etc/os-release")[1].read().decode().strip().split("=")[1].strip('"') | ||
| # Get VERSION_ID from /etc/os-release | ||
| _, out, err = ssh.ssh.exec_command('. /etc/os-release && echo $VERSION_ID') |
There was a problem hiding this comment.
Elsewhere the test is doing: https://github.com/ClusterLabs/hawk/blob/master/e2e_test/hawk_test_results.py#L35-L37
Which is perhaps harder to read, but avoids running a shell.
Perhaps we can move those 3 lines here, then do:
test_version = osrel['VERSION_ID']
And then pass the PRETTY_NAME as an argument to results = ResultSet() (which is some lines above), like:
results = ResultSet(osrel['PRETTY_NAME'])
results.add_ssh_tests()
In any case, I'm approving. Changes LGTM.
There was a problem hiding this comment.
Thanks, would you please help to review again?
1d6bfa6 to
3bd5b85
Compare
| _, out, err = ssh.ssh.exec_command('cat /etc/os-release') | ||
| lines = out.read().decode('utf-8').splitlines() |
There was a problem hiding this comment.
Why not?
with open('/etc/os-release', encoding="utf-8") as file:
lines = file.read().splitlines()
There was a problem hiding this comment.
From my understanding, the original codes fetch OS version from remote HA nodes, not local system running HAWK, so using ssh.ssh.exec_command('cat /etc/os-release')
| # Get version from /etc/os-release | ||
| test_version = ssh.ssh.exec_command("grep VERSION= /etc/os-release")[1].read().decode().strip().split("=")[1].strip('"') | ||
| # Get VERSION_ID from /etc/os-release | ||
| _, out, err = ssh.ssh.exec_command('cat /etc/os-release') |
There was a problem hiding this comment.
I see you are changing VERSION in favor of VERSION_ID, which is indeed more preferable. But this change is also introduced in #310. If merge the PRs chronologically, there might be a conflict.
When running the head of master branch, we observed the followed problem, for example: https://openqa.suse.de/tests/21364964#step/hawk_gui/89
Filed a JIRA ticket https://jira.suse.com/browse/TEAM-11049
After some research, commit cbcd346 modified
from distutils.version import LooseVersion as Versiontofrom packaging.version import VersionThe new "Version" method cannot accept the string like "15-SP7" directly, so I would like to check
VERSION_IDin /etc/os-release instead ofVERSIONfor compatible.VRs:
https://openqa.suse.de/tests/21450880 15-SP4
https://openqa.suse.de/tests/21450874 15-SP5
https://openqa.suse.de/tests/21451116 15-SP6
https://openqa.suse.de/tests/21450865 15-SP7
https://openqa.suse.de/tests/21426733 16.0 (pending)