From a0223a339c09deda39ce368bb5089f880aabd544 Mon Sep 17 00:00:00 2001 From: Christian Theune Date: Fri, 8 Nov 2024 07:00:20 +0100 Subject: [PATCH] fix errors after renaming variables hinted by ruff --- src/fc/qemu/agent.py | 7 ++++--- src/fc/qemu/logging.py | 2 +- tests/hazmat/test_ceph.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/fc/qemu/agent.py b/src/fc/qemu/agent.py index d5a4a90..d269e49 100644 --- a/src/fc/qemu/agent.py +++ b/src/fc/qemu/agent.py @@ -442,7 +442,7 @@ def _get_maintenance_lock_info(self): return f"" @classmethod - def maintenance_enter(cls): + def maintenance_enter(cls) -> None: """Prepare the host for maintenance mode. process exit codes signal success or (temporary) failure @@ -501,7 +501,8 @@ def maintenance_enter(cls): ["pgrep", "-f", "qemu-system-x86_64"], stdout=subprocess.PIPE ) process.wait() - num_procs = len(p.stdout.read().splitlines()) + assert process.stdout is not None + num_procs = len(process.stdout.read().splitlines()) log.info( "evacuation-running", vms=num_procs, @@ -552,7 +553,7 @@ def maintenance_leave(cls): ) @classmethod - def shutdown_all(cls): + def shutdown_all(cls) -> None: """Shut down all VMs cleanly. Runs the shutdowns in parallel to speed up host reboots. diff --git a/src/fc/qemu/logging.py b/src/fc/qemu/logging.py index 7bdafce..f66ccef 100644 --- a/src/fc/qemu/logging.py +++ b/src/fc/qemu/logging.py @@ -73,7 +73,7 @@ class MultiOptimisticLogger(object): def __init__(self, loggers): self.loggers = loggers - def __repr__(self): + def __repr__(self) -> str: return "".format( [repr(logger) for logger in self.loggers] ) diff --git a/tests/hazmat/test_ceph.py b/tests/hazmat/test_ceph.py index 166f577..fb8f1cf 100644 --- a/tests/hazmat/test_ceph.py +++ b/tests/hazmat/test_ceph.py @@ -53,7 +53,7 @@ def test_multiple_images_raises_error(ceph_inst): @pytest.mark.timeout(60) @pytest.mark.live() -def test_rbd_pool_migration(ceph_inst, patterns): +def test_rbd_pool_migration(ceph_inst, patterns) -> None: ceph_inst.cfg["tmp_size"] = 50 * 1024 * 1024 ceph_inst.cfg["swap_size"] = 50 * 1024 * 1024 ceph_inst.cfg["root_size"] = 50 * 1024 * 1024