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

Improve system detection for openSUSE style distributions #723

Merged
merged 2 commits into from
Aug 24, 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
2 changes: 2 additions & 0 deletions testinfra/modules/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def get_module_class(cls, host):
"centos",
"cloudlinux",
"fedora",
"opensuse-leap",
"opensuse-tumbleweed",
"rocky",
)
):
Expand Down
30 changes: 15 additions & 15 deletions testinfra/modules/systeminfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@ def sysinfo(self):
def _get_linux_sysinfo(self):
sysinfo = {}

# LSB
lsb = self.run("lsb_release -a")
if lsb.rc == 0:
for line in lsb.stdout.splitlines():
key, value = line.split(":", 1)
key = key.strip().lower()
value = value.strip().lower()
if key == "distributor id":
sysinfo["distribution"] = value
elif key == "release":
sysinfo["release"] = value
elif key == "codename":
sysinfo["codename"] = value
return sysinfo

# https://www.freedesktop.org/software/systemd/man/os-release.html
os_release = self.run("cat /etc/os-release")
if os_release.rc == 0:
Expand Down Expand Up @@ -100,6 +85,21 @@ def _get_linux_sysinfo(self):
sysinfo["release"] = alpine_release.stdout.strip()
return sysinfo

# LSB
lsb = self.run("lsb_release -a")
if lsb.rc == 0:
for line in lsb.stdout.splitlines():
key, value = line.split(":", 1)
key = key.strip().lower()
value = value.strip().lower()
if key == "distributor id":
sysinfo["distribution"] = value
elif key == "release":
sysinfo["release"] = value
elif key == "codename":
sysinfo["codename"] = value
return sysinfo

return sysinfo

def _get_darwin_sysinfo(self):
Expand Down
Loading