diff --git a/testinfra/modules/systeminfo.py b/testinfra/modules/systeminfo.py index 3c2ee131..86565a47 100644 --- a/testinfra/modules/systeminfo.py +++ b/testinfra/modules/systeminfo.py @@ -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: @@ -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):