From 85421e33cc1c8e9f007aad9edef34d7fd32c482f Mon Sep 17 00:00:00 2001 From: Ivan Pepelnjak Date: Mon, 23 Sep 2024 19:02:24 +0200 Subject: [PATCH] Bug fix: instance ID specified in netlab down could be an int --- netsim/cli/down.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/netsim/cli/down.py b/netsim/cli/down.py index ff4761139..aee7a8fdc 100644 --- a/netsim/cli/down.py +++ b/netsim/cli/down.py @@ -175,9 +175,14 @@ def stop_all(topology: Box, args: argparse.Namespace) -> None: Find a lab instance and change directory so the rest of the shutdown process works from that directory """ -def change_lab_instance(instance: str) -> None: +def change_lab_instance(instance: typing.Union[int,str]) -> None: topology = _read.system_defaults() lab_states = status.read_status(topology) + try: # Maybe the instance is an integer? + instance = int(instance) + except: + pass + if not instance in lab_states: log.fatal(f'Unknown instance {instance}, use "netlab status --all" to display running instances')