From f8eebbfed0969bfeddaed556761fadd9242ae60c Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Tue, 24 Jun 2025 10:59:38 +0200 Subject: [PATCH] Fix linter warnings for arnied --- src/arnied_wrapper.py | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/arnied_wrapper.py b/src/arnied_wrapper.py index 2a7cef8..66d5028 100644 --- a/src/arnied_wrapper.py +++ b/src/arnied_wrapper.py @@ -89,7 +89,7 @@ def verify_running(process='arnied', timeout=60, vm=None): vm.verify_alive() platform_str = " on %s" % vm.name for i in range(timeout): - log.debug("Checking whether %s is running%s (%i\%i)", + log.debug("Checking whether %s is running%s (%i/%i)", process, platform_str, i, timeout) result = run_cmd(cmd="pgrep -l -x %s" % process, ignore_errors=True, vm=vm) @@ -178,12 +178,18 @@ def _wait_for_online_status(status, provider_id, timeout, vm): # ONLINE signal to arnied is transmitted # asynchronously via arnieclient_muxer. + def status_func_online(): + go_online(provider_id, False, vm) + + def status_func_offline(): + go_offline(False, vm) + if status == 'online': expected_output = 'DEFAULT: 2' - set_status_func = lambda: go_online(provider_id, False, vm) + set_status_func = status_func_online elif status == 'offline': expected_output = 'DEFAULT: 0' - set_status_func = lambda: go_offline(False, vm) + set_status_func = status_func_offline else: raise ValueError('expect status "online" or "offline", not "{0}"!' .format(status)) @@ -319,8 +325,8 @@ def schedule(program, exec_time=0, optional_args="", vm=None): contents = "%i\n%s\n" % (exec_time, optional_args) tmp_file = tempfile.NamedTemporaryFile(mode="w+", - prefix=program.upper() + "_", - delete=False) + prefix=program.upper() + "_", + delete=False) log.debug("Created temporary file %s", tmp_file.name) tmp_file.write(contents) tmp_file.close() -- 1.7.1