From 96f57a175cd577762018478eead631547fd72dc4 Mon Sep 17 00:00:00 2001 From: "Christian R. Garcia" Date: Fri, 22 Nov 2024 12:34:45 -0800 Subject: [PATCH] take into account template derivation --- service/api_pods_podid_func.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/service/api_pods_podid_func.py b/service/api_pods_podid_func.py index e987173..ef0c04e 100644 --- a/service/api_pods_podid_func.py +++ b/service/api_pods_podid_func.py @@ -348,6 +348,12 @@ async def pod_auth(pod_id_net, request: Request): # if not authenticated, start the OAuth flow pod = Pod.db_get_with_pk(pod_id, tenant=g.request_tenant_id, site=g.site_id) + if pod.template: + # Derive the final pod object by combining the pod and templates + final_pod = combine_pod_and_template_recursively(pod, pod.template, tenant=g.request_tenant_id, site=g.site_id) + else: + final_pod = pod + net_info = pod.networking.get(network_key, None) if not net_info: raise Exception(f"Pod {pod_id} does not have networking key that matches pod_id_net: {pod_id_net}") @@ -434,6 +440,12 @@ def callback(pod_id_net, request: Request): network_key = parts[1] if len(parts) > 1 else 'default' pod = Pod.db_get_with_pk(pod_id, tenant=g.request_tenant_id, site=g.site_id) + if pod.template: + # Derive the final pod object by combining the pod and templates + final_pod = combine_pod_and_template_recursively(pod, pod.template, tenant=g.request_tenant_id, site=g.site_id) + else: + final_pod = pod + net_info = pod.networking.get(network_key, None) if not net_info: raise Exception(f"Pod {pod_id} does not have networking key that matches pod_id_net: {pod_id_net}")