diff options
author | Paul Bonaud <paul.bonaud@fretlink.com> | 2019-10-11 17:44:42 +0200 |
---|---|---|
committer | Paul Bonaud <paul.bonaud@fretlink.com> | 2019-10-11 18:05:24 +0200 |
commit | 424481c071a7928bde723b7643788f284d3e6689 (patch) | |
tree | 4695112c86c7d3ba9630cf5371c2134e31c09c09 /tasks | |
parent | 78c6d0494b38f752ffd5ce6faf7bf00b0b2a11c9 (diff) | |
download | ansible-clever-424481c071a7928bde723b7643788f284d3e6689.tar.gz ansible-clever-424481c071a7928bde723b7643788f284d3e6689.tar.zst ansible-clever-424481c071a7928bde723b7643788f284d3e6689.zip |
fix: addon environment variables fetch for clever >= 1.5.0
It seems the output of `clever env` has changed and now env values are
surrounded by quotes with the latest 1.5.0 clever tools version.
We used to add quotes ourselves because they were missing in the
output. So this commit is adapting its parsing depending of the clever
tools' version.
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/addon.yml | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tasks/addon.yml b/tasks/addon.yml index cd1f977..328664d 100644 --- a/tasks/addon.yml +++ b/tasks/addon.yml | |||
@@ -1,4 +1,4 @@ | |||
1 | - name: Gather addon information for {{ addon.name }} | 1 | - name: Gather addon information for {{ addon.name }} (clever --version < 1.5.0) |
2 | shell: > | 2 | shell: > |
3 | set -o pipefail && | 3 | set -o pipefail && |
4 | clever env | grep {{ addon.env_prefix }} | 4 | clever env | grep {{ addon.env_prefix }} |
@@ -10,6 +10,21 @@ | |||
10 | environment: | 10 | environment: |
11 | CONFIGURATION_FILE: "{{ clever_login_file }}" | 11 | CONFIGURATION_FILE: "{{ clever_login_file }}" |
12 | changed_when: False | 12 | changed_when: False |
13 | when: clever_returned_version.stdout is version('1.5.0', '<') | ||
14 | |||
15 | - name: Gather addon information for {{ addon.name }} (clever --version >= 1.5.0) | ||
16 | shell: > | ||
17 | set -o pipefail && | ||
18 | clever env | grep {{ addon.env_prefix }} | ||
19 | | sed -e 's/{{ addon.env_prefix }}_//' -e 's/=/: /' | ||
20 | > {{ clever_app_confdir }}/{{ addon.name }}_env.yml | ||
21 | args: | ||
22 | chdir: "{{ clever_app_root }}" | ||
23 | executable: "bash" | ||
24 | environment: | ||
25 | CONFIGURATION_FILE: "{{ clever_login_file }}" | ||
26 | changed_when: False | ||
27 | when: clever_returned_version.stdout is version('1.5.0', '>=') | ||
13 | 28 | ||
14 | - name: Include addon var for {{ addon.name }} | 29 | - name: Include addon var for {{ addon.name }} |
15 | include_vars: | 30 | include_vars: |