Merge pull request #10618 from louis-oui/topo-win-title

topotests: fix the usage of screen
This commit is contained in:
Jafar Al-Gharaibeh 2022-02-21 10:26:34 -06:00 committed by GitHub
commit f8ce626944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -358,11 +358,14 @@ class Commander(object): # pylint: disable=R0205
# wait for not supported in screen for now
channel = None
cmd = [self.get_exec_path("screen")]
if title:
cmd.append("-t")
cmd.append(title)
if not os.path.exists(
"/run/screen/S-{}/{}".format(os.environ["USER"], os.environ["STY"])
):
cmd = ["sudo", "-u", os.environ["SUDO_USER"]] + cmd
cmd.append(nscmd)
cmd.extend(nscmd.split(" "))
elif "DISPLAY" in os.environ:
# We need it broken up for xterm
user_cmd = cmd

View File

@ -113,11 +113,11 @@ def doline(unet, line, writef):
hosts = [unet.hosts[x] for x in args]
for host in hosts:
if cmd == "t" or cmd == "term":
host.run_in_window("bash")
host.run_in_window("bash", title="sh-%s" % host)
elif cmd == "v" or cmd == "vtysh":
host.run_in_window("vtysh")
host.run_in_window("vtysh", title="vt-%s" % host)
elif cmd == "x" or cmd == "xterm":
host.run_in_window("bash", forcex=True)
host.run_in_window("bash", title="sh-%s" % host, forcex=True)
elif cmd == "sh":
hosts, cmd = host_cmd_split(unet, oargs)
for host in hosts:

View File

@ -1613,7 +1613,7 @@ class Router(Node):
shell_routers = g_extra_config["shell"]
if "all" in shell_routers or self.name in shell_routers:
self.run_in_window(os.getenv("SHELL", "bash"))
self.run_in_window(os.getenv("SHELL", "bash"), title="sh-%s" % self.name)
if self.daemons["eigrpd"] == 1:
eigrpd_path = os.path.join(self.daemondir, "eigrpd")
@ -1631,7 +1631,7 @@ class Router(Node):
vtysh_routers = g_extra_config["vtysh"]
if "all" in vtysh_routers or self.name in vtysh_routers:
self.run_in_window("vtysh")
self.run_in_window("vtysh", title="vt-%s" % self.name)
return status