From 2fed770ee552e420c03d889d842585ebed19577f Mon Sep 17 00:00:00 2001 From: Pablo Rodriguez Nava Date: Mon, 16 Dec 2024 16:21:10 +0100 Subject: [PATCH] Consider that the zuul executor may be an IP Exposed a variable to pass the API endpoint without computing it too. --- ci/playbooks/multinode-autohold.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ci/playbooks/multinode-autohold.yml b/ci/playbooks/multinode-autohold.yml index db5a6ecc4b..3e19ae0e48 100644 --- a/ci/playbooks/multinode-autohold.yml +++ b/ci/playbooks/multinode-autohold.yml @@ -20,10 +20,16 @@ block: - name: Fetch existing autoholds from zuul vars: + _zuul_host: >- + {{ + zuul.executor.hostname + if (zuul.executor.hostname is ansible.utils.ip) else + (zuul.executor.hostname | split('.'))[1:] | join('.') + }} _zuul_api_url: >- {{ [ - ('https://'+ (zuul.executor.hostname | split('.'))[1:] | join('.')), + ('https://'+ _zuul_host, 'zuul', 'api', 'tenant', @@ -32,7 +38,7 @@ ] | join('/') }} ansible.builtin.uri: - url: "{{ _zuul_api_url }}" + url: "{{ zuul_autohold_endpoint | default(_zuul_api_url) }}" method: GET headers: Content-Type: "application/json"