Browse Source

Two corrections

jherve 1 tháng trước cách đây
mục cha
commit
85df5d11e3
1 tập tin đã thay đổi với 2 bổ sung6 xóa
  1. 2 6
      pc_backup/podman.py

+ 2 - 6
pc_backup/podman.py

@@ -89,14 +89,10 @@ class Podman:
         out = subprocess.check_output(args, **kwargs)
         print(out.decode())
 
-    @classmethod
-    def ps(cls):
-        out = subprocess.run(["podman", "ps"], capture_output=True, check=True)
-
     @classmethod
     def machine_is_running(cls) -> bool:
         try:
-            cls.ps()
+            subprocess.run(["podman", "ps"], capture_output=True, check=True)
         except subprocess.CalledProcessError as e:
             if "Cannot connect to Podman" in e.stderr.decode():
                 return False
@@ -119,7 +115,7 @@ class Podman:
         try:
             run_and_output()
         except subprocess.CalledProcessError as e:
-            if not cls.machine_is_running:
+            if not cls.machine_is_running():
                 print("podman not running, starting it")
                 cls.machine_start()
                 run_and_output()