image-info: extract package listing into function
Move the logic that retrieves the installed packages via rpm into its own function.
This commit is contained in:
parent
7a250188bf
commit
18d1dcee20
1 changed files with 6 additions and 1 deletions
|
|
@ -164,6 +164,11 @@ def rpm_verify(tree):
|
|||
}
|
||||
|
||||
|
||||
def rpm_packages(tree):
|
||||
pkgs = subprocess_check_output(["rpm", "--root", tree, "-qa"], str.split)
|
||||
return list(sorted(pkgs))
|
||||
|
||||
|
||||
def read_services(tree, state):
|
||||
return subprocess_check_output(["systemctl", f"--root={tree}", "list-unit-files"], (lambda s: parse_unit_files(s, state)))
|
||||
|
||||
|
|
@ -190,7 +195,7 @@ def read_firewall_zone(tree):
|
|||
|
||||
def append_filesystem(report, tree):
|
||||
if os.path.exists(f"{tree}/etc/os-release"):
|
||||
report["packages"] = sorted(subprocess_check_output(["rpm", "--root", tree, "-qa"], str.split))
|
||||
report["packages"] = rpm_packages(tree)
|
||||
report["rpm-verify"] = rpm_verify(tree)
|
||||
|
||||
with open(f"{tree}/etc/os-release") as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue