proxy: ensure use of only active proxies for smart proxy

This commit is contained in:
Iain Learmonth 2022-05-27 15:24:34 +01:00
parent b0fe83b984
commit 8c411e39bc

View file

@ -20,7 +20,6 @@ def update_smart_proxy_instance(group_id: int,
provider: str,
region: str,
instance_id: str) -> None:
print("SMART PROXY")
instance = SmartProxy.query.filter(
SmartProxy.group_id == group_id,
SmartProxy.region == region,
@ -176,9 +175,9 @@ class ProxyAutomation(TerraformAutomation):
subs_filter https://{{ origin.domain_name }}/ /;
subs_filter "\\\"https://{{ origin.domain_name }}\\\"" /;
{%- for asset_origin in origin.group.origins | selectattr("assets") -%}
{%- for asset_proxy in asset_origin.proxies | selectattr("provider", "equalto", provider) -%}
{%- for asset_proxy in asset_origin.proxies | selectattr("provider", "equalto", provider) | selectattr("deprecated", "none") | selectattr("destroyed", "none") -%}
{%- if loop.first %}
subs_filter https://{{ asset_origin.domain_name }}/ {{ asset_proxy.url }}/
subs_filter https://{{ asset_origin.domain_name }}/ {{ asset_proxy.url }}/;
{%- endif -%}
{%- endfor -%}
{%- endfor %}