From ab6fc116caa42a92ba33aab5d298455f9beee6dd Mon Sep 17 00:00:00 2001 From: checktheroads Date: Thu, 23 Jul 2020 09:10:26 -0700 Subject: [PATCH] Minor improvements --- .gitignore | 1 + hyperglass/api/__init__.py | 6 +++++- hyperglass/configuration/models/commands/cisco_ios.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7d53642..a56d82f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ test.py .DS_Store .idea .vscode +old_*.py # # Github Default from https://github.com/martinohanlon/flightlight/issues/1 # Byte-compiled / optimized / DLL files diff --git a/hyperglass/api/__init__.py b/hyperglass/api/__init__.py index e0b52b7..a9de039 100644 --- a/hyperglass/api/__init__.py +++ b/hyperglass/api/__init__.py @@ -1,6 +1,7 @@ """hyperglass REST API & Web UI.""" # Standard Library +import sys from typing import List from pathlib import Path @@ -265,4 +266,7 @@ def start(**kwargs): """Start the web server with Uvicorn ASGI.""" import uvicorn - uvicorn.run("hyperglass.api:app", **ASGI_PARAMS, **kwargs) + try: + uvicorn.run("hyperglass.api:app", **ASGI_PARAMS, **kwargs) + except KeyboardInterrupt: + sys.exit(1) diff --git a/hyperglass/configuration/models/commands/cisco_ios.py b/hyperglass/configuration/models/commands/cisco_ios.py index 76f61aa..40fff33 100644 --- a/hyperglass/configuration/models/commands/cisco_ios.py +++ b/hyperglass/configuration/models/commands/cisco_ios.py @@ -23,7 +23,7 @@ class _IPv6(CommandSet): bgp_community: StrictStr = "show bgp ipv6 unicast community {target}" bgp_aspath: StrictStr = 'show bgp ipv6 unicast quote-regexp "{target}"' bgp_route: StrictStr = "show bgp ipv6 unicast {target} | exclude pathid:|Epoch" - ping: StrictStr = ("ping ipv6 {target} repeat 5 source {source}") + ping: StrictStr = "ping ipv6 {target} repeat 5 source {source}" traceroute: StrictStr = ( "traceroute ipv6 {target} timeout 1 probe 2 source {source}" )