From 3c28ea373a701e46d6de39644b872e88289c7922 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 10 Jun 2022 14:53:49 -0700 Subject: [PATCH] daemon: adjustments to fix terminal command string generation for docker/lxd nodes to account for being on a distributed server --- daemon/core/nodes/docker.py | 6 +++++- daemon/core/nodes/lxd.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/daemon/core/nodes/docker.py b/daemon/core/nodes/docker.py index 41625c78..45d2b892 100644 --- a/daemon/core/nodes/docker.py +++ b/daemon/core/nodes/docker.py @@ -188,7 +188,11 @@ class DockerNode(CoreNode): :param sh: shell to execute command in :return: str """ - return f"{DOCKER} exec -it {self.name} {sh}" + terminal = f"{DOCKER} exec -it {self.name} {sh}" + if self.server is None: + return terminal + else: + return f"ssh -X -f {self.server.host} xterm -e {terminal}" def create_dir(self, dir_path: Path) -> None: """ diff --git a/daemon/core/nodes/lxd.py b/daemon/core/nodes/lxd.py index 33b8d466..01bd2db7 100644 --- a/daemon/core/nodes/lxd.py +++ b/daemon/core/nodes/lxd.py @@ -130,7 +130,11 @@ class LxcNode(CoreNode): :param sh: shell to execute command in :return: str """ - return f"lxc exec {self.name} -- {sh}" + terminal = f"lxc exec {self.name} -- {sh}" + if self.server is None: + return terminal + else: + return f"ssh -X -f {self.server.host} xterm -e {terminal}" def create_dir(self, dir_path: Path) -> None: """