From 528d28b1c130060e34b5227c1101e917b118d6a7 Mon Sep 17 00:00:00 2001 From: Jens Reidel Date: Sun, 2 Jun 2024 00:44:56 +0200 Subject: [PATCH] Add handling for renamed devices Signed-off-by: Jens Reidel --- api_common.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api_common.py b/api_common.py index 1a0cd5a..2e4666f 100644 --- a/api_common.py +++ b/api_common.py @@ -11,6 +11,8 @@ import extensions +RENAMED_DEVICES = {"taranis": "thor", "dagda": "zeus"} + @extensions.cache.memoize() def get_builds(): try: @@ -28,6 +30,8 @@ def get_devices_with_builds(): @extensions.cache.memoize() def get_device_builds(device): + device = RENAMED_DEVICES.get(device, device) + builds = get_builds() if device not in builds: return [] @@ -93,6 +97,8 @@ def get_devices_data(): @extensions.cache.memoize() def get_device_data(device): + device = RENAMED_DEVICES.get(device, device) + devices_data = get_devices_data() for device_data in devices_data: