From: Petr Michalec Date: Tue, 9 Jan 2018 13:00:19 +0000 (+0100) Subject: Fix echo of stdout for fail_on function X-Git-Url: https://gerrit.mcp.mirantis.com/gitweb?p=salt-formulas%2Finfluxdb.git;a=commitdiff_plain;h=2092a9083c3b57e8441de831af835f9ec356b499;ds=sidebyside Fix echo of stdout for fail_on function Change-Id: Ie0506c64fae8a751b9e0d858230acc6f576b5b34 --- diff --git a/influxdb/client.sls b/influxdb/client.sls index 5ef378e..3015a53 100644 --- a/influxdb/client.sls +++ b/influxdb/client.sls @@ -91,7 +91,7 @@ influxdb_grant_{{ grant_name }}: influxdb_continuous_query_{{db_name}}_{{ cq_name }}: cmd.run: - shell: /bin/bash - - name: fail_on() { echo $2; if [[ "$2" == *"$1"* ]]; then return 1; return 0; fi; }; fail_on "already exist" $({{ curl_command }} -s -S -POST "{{ auth_url }}" --data-urlencode "q=CREATE {{ query_continuous_query }}") || fail_on error $({{ curl_command }} -s -S -POST "{{ auth_url }}" --data-urlencode $'q=DROP {{ cq_name_on }};\nCREATE {{ query_continuous_query }}') + - name: fail_on() { echo "${@:2}"; if [[ "${@:2}" == *"$1"* ]]; then return 1; return 0; fi; }; fail_on "already exist" $({{ curl_command }} -s -S -POST "{{ auth_url }}" --data-urlencode "q=CREATE {{ query_continuous_query }}") || fail_on error $({{ curl_command }} -s -S -POST "{{ auth_url }}" --data-urlencode $'q=DROP {{ cq_name_on }};\nCREATE {{ query_continuous_query }}') - onlyif: {{ curl_command }} -s -S -POST "{{ auth_url }}" --data-urlencode "q=SHOW DATABASES" | grep {{ db_name }} {%- endfor %}