From 43c57522f1adf67a4541bbb35f8939ef7e7a3dfe Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 13 Dec 2018 12:03:17 +0100 Subject: [PATCH] Remove some conditionals from the wps-config-fixer script. Add a new tag and variable to the dataminer tasks that install and run the script so that we can force a tomcat restart. --- prometheus-alert-manager/tasks/main.yml | 0 .../dataminer_app/templates/wps-config-fixer.j2 | 11 +++-------- 2 files changed, 3 insertions(+), 8 deletions(-) create mode 100644 prometheus-alert-manager/tasks/main.yml diff --git a/prometheus-alert-manager/tasks/main.yml b/prometheus-alert-manager/tasks/main.yml new file mode 100644 index 00000000..e69de29b diff --git a/smartgears/dataminer_app/templates/wps-config-fixer.j2 b/smartgears/dataminer_app/templates/wps-config-fixer.j2 index 05c7ca62..e14af31a 100644 --- a/smartgears/dataminer_app/templates/wps-config-fixer.j2 +++ b/smartgears/dataminer_app/templates/wps-config-fixer.j2 @@ -10,19 +10,14 @@ sed -Ei 's/hostname=\".*\"\ hostport/hostname="{{ hostname }}" hostport/' "$WPS_ sed -Ei 's/hostname=\".*\"\ hostport/hostname="{{ smartgears_hostname }}" hostport/' "$WPS_CONFIG_FILE" {% endif %} -# Fix the port +# Set the port. It is different from the tomcat one if there is a reverse proxy before the service. +# https has the precedence if it is available {% if setup_nginx %} {% if https_port is defined %} -# {% if http_redirect_to_https is defined and http_redirect_to_https %} sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ https_port }}" includeDataInputsInResponse/' "$WPS_CONFIG_FILE" sed -Ei 's/protocol=\".*\"\ hostname/protocol="https" hostname/' "$WPS_CONFIG_FILE" -# {% else %} -# sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ http_port }}" includeDataInputsInResponse/' "$WPS_CONFIG_FILE" -#{% endif %} {% else %} -{% if http_port is defined %} -sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ http_port }}" includeDataInputsInResponse/' "$WPS_CONFIG_FILE" -{% endif %} +sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ http_port | default('80') }}" includeDataInputsInResponse/' "$WPS_CONFIG_FILE" {% endif %} {% else %} sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ item.http_port }}" includeDataInputsInResponse/' "$WPS_CONFIG_FILE"