]> glassweightruler.freedombox.rocks Git - waydroid.git/commitdiff
lxc: Handle lxc-info failure
authorAlessandro Astone <ales.astone@gmail.com>
Sun, 29 Jan 2023 21:38:23 +0000 (22:38 +0100)
committerAlessandro Astone <ales.astone@gmail.com>
Sun, 29 Jan 2023 22:09:24 +0000 (23:09 +0100)
So that init/upgrade can go on and regenerate the lxc configs if
that's what's broken

tools/helpers/lxc.py

index 3f7ad74360828853f2b3bb7fd0b0b628c2ca680b..5007e2beffe1b59e5f46726b7bc29c3d2e51edc7 100644 (file)
@@ -372,8 +372,11 @@ def setup_host_perms(args):
 
 def status(args):
     command = ["lxc-info", "-P", tools.config.defaults["lxc"], "-n", "waydroid", "-sH"]
-    out = subprocess.run(command, stdout=subprocess.PIPE).stdout.decode('utf-8').strip()
-    return out
+    try:
+        return tools.helpers.run.user(args, command, output_return=True).strip()
+    except:
+        logging.info("Couldn't get LXC status. Assuming STOPPED.")
+        return "STOPPED"
 
 def wait_for_running(args):
     lxc_status = status(args)