Skip to content

Commit

Permalink
take into account template derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
NotChristianGarcia committed Nov 22, 2024
1 parent 168c2ec commit 96f57a1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions service/api_pods_podid_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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}")
Expand Down

0 comments on commit 96f57a1

Please sign in to comment.