From 82d33a35ae5d67d595c89c576ddc84a495120367 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Thu, 8 Jul 2021 07:23:03 +0000 Subject: [PATCH] api: remove unused 'monitor' parameter The monitor parameter, which previously was used for stream logs to via the output handling of API, is now no longer needed. Thus, it can be removed. --- osbuild/api.py | 3 +-- osbuild/pipeline.py | 2 +- test/mod/test_api.py | 9 +++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/osbuild/api.py b/osbuild/api.py index 141966bd..438a4750 100644 --- a/osbuild/api.py +++ b/osbuild/api.py @@ -139,10 +139,9 @@ class API(BaseAPI): endpoint = "osbuild" - def __init__(self, args, monitor, *, socket_address=None): + def __init__(self, args, *, socket_address=None): super().__init__(socket_address) self.input = args - self.monitor = monitor self.metadata = {} self.error = None diff --git a/osbuild/pipeline.py b/osbuild/pipeline.py index 66cc3765..879cdf46 100644 --- a/osbuild/pipeline.py +++ b/osbuild/pipeline.py @@ -147,7 +147,7 @@ class Stage: data = mount.mount(mgr, abspath, mounts_tmpdir) mounts[key] = data - api = API(args, monitor) + api = API(args) build_root.register_api(api) rls = remoteloop.LoopServer() diff --git a/test/mod/test_api.py b/test/mod/test_api.py index 1576d774..c2454874 100644 --- a/test/mod/test_api.py +++ b/test/mod/test_api.py @@ -72,9 +72,8 @@ class TestAPI(unittest.TestCase): tmpdir = self.tmp.name path = os.path.join(tmpdir, "osbuild-api") args = {"options": {"answer": 42}} - monitor = osbuild.monitor.BaseMonitor(sys.stderr.fileno()) - with osbuild.api.API(args, monitor, socket_address=path) as _: + with osbuild.api.API(args, socket_address=path) as _: data = osbuild.api.arguments(path=path) self.assertEqual(data, args) @@ -83,14 +82,13 @@ class TestAPI(unittest.TestCase): tmpdir = self.tmp.name path = os.path.join(tmpdir, "osbuild-api") args = {} - monitor = osbuild.monitor.BaseMonitor(sys.stderr.fileno()) def exception(path): with osbuild.api.exception_handler(path): raise ValueError("osbuild test exception") assert False, "api.exception should exit process" - api = osbuild.api.API(args, monitor, socket_address=path) + api = osbuild.api.API(args, socket_address=path) with api: p = mp.Process(target=exception, args=(path, )) p.start() @@ -112,14 +110,13 @@ class TestAPI(unittest.TestCase): tmpdir = self.tmp.name path = os.path.join(tmpdir, "osbuild-api") args = {} - monitor = osbuild.monitor.BaseMonitor(sys.stderr.fileno()) def metadata(path): data = {"meta": "42"} osbuild.api.metadata(data, path=path) return 0 - api = osbuild.api.API(args, monitor, socket_address=path) + api = osbuild.api.API(args, socket_address=path) with api: p = mp.Process(target=metadata, args=(path, )) p.start()