From 9021586a8685a3993e529d7cc3efaeb8da6daf8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Tue, 24 Apr 2018 18:22:00 +0200 Subject: [PATCH] when an api is freshly created, there is not proxy definition for the prod environment: be prepared for that --- tasks/promote.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/promote.yml b/tasks/promote.yml index 105b18d..a382607 100644 --- a/tasks/promote.yml +++ b/tasks/promote.yml @@ -13,10 +13,16 @@ uri: url: 'https://{{ inventory_hostname }}/admin/api/services/{{ threescale_cicd_api_service_id }}/proxy/configs/{{ threescale_cicd_production_environment_name }}/latest.json?access_token={{ threescale_cicd_access_token|urlencode }}' validate_certs: no + status_code: 200,404 register: threescale_cicd_tmpresponse - set_fact: threescale_cicd_tmp_production_proxy_version: '{{ threescale_cicd_tmpresponse.json.proxy_config.version }}' + when: 'threescale_cicd_tmpresponse.status == 200' + +- set_fact: + threescale_cicd_tmp_production_proxy_version: 'NONE' + when: 'threescale_cicd_tmpresponse.status == 404' - set_fact: threescale_cicd_tmp_body_create_svc: 'access_token={{ threescale_cicd_access_token|urlencode }}&to={{ threescale_cicd_production_environment_name|urlencode }}'