daemon: adjustments to fix terminal command string generation for docker/lxd nodes to account for being on a distributed server

This commit is contained in:
Blake Harnden 2022-06-10 14:53:49 -07:00
parent 9c69881aad
commit 3c28ea373a
2 changed files with 10 additions and 2 deletions

View file

@ -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:
"""

View file

@ -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:
"""