osbuild-image-info: don't fail on no systemd default target
Some image types don't have systemd installed and don't have any default target set, e.g. 'tar' image type. Running osbuild-image-info on such image would result in traceback (e.g. [1]). Handle this case gracefully. [1] https://gitlab.com/redhat/services/products/image-builder/ci/osbuild/-/jobs/8911649248#L6480 Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
e1b6c26bfb
commit
cb4bd7051b
1 changed files with 4 additions and 1 deletions
|
|
@ -602,7 +602,10 @@ def read_default_target(tree):
|
|||
An example return value:
|
||||
"multi-user.target"
|
||||
"""
|
||||
return subprocess_check_output(["systemctl", f"--root={tree}", "get-default"]).rstrip()
|
||||
try:
|
||||
return subprocess_check_output(["systemctl", f"--root={tree}", "get-default"]).rstrip()
|
||||
except subprocess.CalledProcessError:
|
||||
return ""
|
||||
|
||||
|
||||
def read_firewall_default_zone(tree):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue