From 1e83fed0a29559bfb019b93101a368d4606e7d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Solbj=C3=B8rg?= Date: Mon, 3 Apr 2023 09:55:11 +0200 Subject: feat(labler): Update to tg23 syntax --- tech-support/labels/gondul.py | 6 +++--- tech-support/labels/main.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tech-support/labels/gondul.py b/tech-support/labels/gondul.py index 74c1a23..c9fc538 100644 --- a/tech-support/labels/gondul.py +++ b/tech-support/labels/gondul.py @@ -7,7 +7,7 @@ import urllib.request GONDUL_USERNAME = os.getenv("GONDUL_USERNAME", "") GONDUL_PASSWORD = os.getenv("GONDUL_PASSWORD", "") -GONDUL_API = os.getenv("GONDUL_API", "https://tg18.gondul.gathering.org/api") +GONDUL_API = os.getenv("GONDUL_API", "https://gondul.tg23.gathering.org/api") GONDUL_SWITCHES_ENDPOINT = os.getenv( "GONDUL_SWITCHES_ENDPOINT", "/public/switches") @@ -40,7 +40,7 @@ def _do_switches_request( return switches -def _match_switches(switches, match="^e(.*)"): +def _match_switches(switches, match="^e([0-9]+-[0-9]+)"): pattern = re.compile(match) included_switches = [] @@ -61,7 +61,7 @@ def _sort_switches(switches): return sorted(switches, key=lambda x: (int(x[1:].split("-")[0]), x.split("-")[1])) -def fetch_gondul_switches(api=None, endpoint=None, username=None, password=None, match="^e(.*)"): +def fetch_gondul_switches(api=None, endpoint=None, username=None, password=None, match="^e([0-9]+-[0-9]+)"): # Use provided arg instead of environment variable if defined. _api = api if api is not None else GONDUL_API _endpoint = endpoint if endpoint is not None else GONDUL_SWITCHES_ENDPOINT diff --git a/tech-support/labels/main.py b/tech-support/labels/main.py index c7d1f14..bb6cd23 100644 --- a/tech-support/labels/main.py +++ b/tech-support/labels/main.py @@ -18,7 +18,7 @@ parser.add_argument("--gondul-api", type=str, help="Gondul API base. Overrides env GONDUL_API") parser.add_argument("--gondul-switches", type=str, help="Gondul switches endpoint. Overrides env GONDUL_SWITCHES_ENDPOINT") -parser.add_argument("--match-switches", type=str, default="^e(.*)", +parser.add_argument("--match-switches", type=str, default="^e([0-9]+-[0-9]+)", help="Regex for matching switches") parser.add_argument("--outfile", "-o", type=str, default=None, help="Output (base) file name. Might be appended with numbers for cables.") -- cgit v1.2.3