From 0e6b4749f7b9e856eb887ca18f6e78eefe2da172 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 7 Oct 2020 16:31:07 +0200 Subject: [PATCH] runner: use osbuild.api.exception_handler Wrap all calls to the various setup functions in the new exception handler provided by `osbuild.api`. This will make sure that any exception is properly printed to stderr, as well as communicated to osbuild in a structured and machine readable way. --- runners/org.osbuild.fedora30 | 15 +++++++++------ runners/org.osbuild.rhel81 | 19 +++++++++++-------- runners/org.osbuild.rhel82 | 17 ++++++++++------- runners/org.osbuild.ubuntu1804 | 15 +++++++++------ 4 files changed, 39 insertions(+), 27 deletions(-) diff --git a/runners/org.osbuild.fedora30 b/runners/org.osbuild.fedora30 index 406ba0c0..963e2bc5 100755 --- a/runners/org.osbuild.fedora30 +++ b/runners/org.osbuild.fedora30 @@ -4,6 +4,8 @@ import os import subprocess import sys +import osbuild.api + def ldconfig(): # ld.so.conf must exist, or `ldconfig` throws a warning @@ -36,10 +38,11 @@ def nsswitch(): if __name__ == "__main__": - ldconfig() - sysusers() - tmpfiles() - nsswitch() + with osbuild.api.exception_handler(): + ldconfig() + sysusers() + tmpfiles() + nsswitch() - r = subprocess.run(sys.argv[1:], check=False) - sys.exit(r.returncode) + r = subprocess.run(sys.argv[1:], check=False) + sys.exit(r.returncode) diff --git a/runners/org.osbuild.rhel81 b/runners/org.osbuild.rhel81 index 03f5fa12..925326e3 100755 --- a/runners/org.osbuild.rhel81 +++ b/runners/org.osbuild.rhel81 @@ -4,6 +4,8 @@ import os import subprocess import sys +import osbuild.api + def ldconfig(): # ld.so.conf must exist, or `ldconfig` throws a warning @@ -70,12 +72,13 @@ def python_alternatives(): pass if __name__ == "__main__": - ldconfig() - sysusers() - tmpfiles() - nsswitch() - os_release() - python_alternatives() + with osbuild.api.exception_handler(): + ldconfig() + sysusers() + tmpfiles() + nsswitch() + os_release() + python_alternatives() - r = subprocess.run(sys.argv[1:], check=False) - sys.exit(r.returncode) + r = subprocess.run(sys.argv[1:], check=False) + sys.exit(r.returncode) diff --git a/runners/org.osbuild.rhel82 b/runners/org.osbuild.rhel82 index 9c6a9658..b4433701 100755 --- a/runners/org.osbuild.rhel82 +++ b/runners/org.osbuild.rhel82 @@ -4,6 +4,8 @@ import os import subprocess import sys +import osbuild.api + def ldconfig(): # ld.so.conf must exist, or `ldconfig` throws a warning @@ -48,11 +50,12 @@ def python_alternatives(): pass if __name__ == "__main__": - ldconfig() - sysusers() - tmpfiles() - nsswitch() - python_alternatives() + with osbuild.api.exception_handler(): + ldconfig() + sysusers() + tmpfiles() + nsswitch() + python_alternatives() - r = subprocess.run(sys.argv[1:], check=False) - sys.exit(r.returncode) + r = subprocess.run(sys.argv[1:], check=False) + sys.exit(r.returncode) diff --git a/runners/org.osbuild.ubuntu1804 b/runners/org.osbuild.ubuntu1804 index 406ba0c0..963e2bc5 100755 --- a/runners/org.osbuild.ubuntu1804 +++ b/runners/org.osbuild.ubuntu1804 @@ -4,6 +4,8 @@ import os import subprocess import sys +import osbuild.api + def ldconfig(): # ld.so.conf must exist, or `ldconfig` throws a warning @@ -36,10 +38,11 @@ def nsswitch(): if __name__ == "__main__": - ldconfig() - sysusers() - tmpfiles() - nsswitch() + with osbuild.api.exception_handler(): + ldconfig() + sysusers() + tmpfiles() + nsswitch() - r = subprocess.run(sys.argv[1:], check=False) - sys.exit(r.returncode) + r = subprocess.run(sys.argv[1:], check=False) + sys.exit(r.returncode)