[elbe-devel] [PATCH 06/18] elbepack: initvm: call list_projects() directly

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Aug 13 13:15:36 CEST 2024


Instead of going through "elbe control", call the list_projects()
method directly. This reuses existing connections and improves the error
reporting.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/initvm.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/elbepack/initvm.py b/elbepack/initvm.py
index 83b7b6fe4fee..381849d6552b 100644
--- a/elbepack/initvm.py
+++ b/elbepack/initvm.py
@@ -15,7 +15,6 @@ import textwrap
 import time
 
 from elbepack.cli import CliError, with_cli_details
-from elbepack.directories import run_elbe
 from elbepack.treeutils import etree
 
 
@@ -44,9 +43,11 @@ def _test_soap_communication(control, sleep=10, wait=120):
     while True:
         if _is_soap_port_reachable(control):
             control.connect()
-            ps = run_elbe(['control', '--port', str(control.port), 'list_projects'],
-                          capture_output=True, encoding='utf-8')
-            if ps.returncode == 0:
+            try:
+                control.service.list_projects()
+            except Exception:
+                pass
+            else:
                 break
         if time.time() > stop:
             raise CliError(123, f'Waited for {wait/60} minutes and the daemon is still not active.')

-- 
2.46.0



More information about the elbe-devel mailing list