Fix linter warnings for arnied
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 24 Jun 2025 08:59:38 +0000 (10:59 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 24 Jun 2025 10:43:24 +0000 (12:43 +0200)
src/arnied_wrapper.py

index 2a7cef8..66d5028 100644 (file)
@@ -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()