Skip to content

Commit

Permalink
Bug fix: instance ID specified in netlab down could be an int
Browse files Browse the repository at this point in the history
  • Loading branch information
ipspace committed Sep 23, 2024
1 parent b09a7a9 commit 85421e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion netsim/cli/down.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down

0 comments on commit 85421e3

Please sign in to comment.