Skip to content

Commit

Permalink
fix: fail early when using promtail_binary_local_dir (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickjahns authored Feb 11, 2023
1 parent 6dfc5aa commit 7c7c4aa
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tasks/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@
when:
- promtail_version == "latest"

- name: Test if zip local archive exists
stat:
path: "{{ promtail_binary_local_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip"
register: promtail_binary_local_archive
delegate_to: localhost
run_once: True
- block:
- name: Test if zip local archive exists
stat:
path: "{{ promtail_binary_local_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip"
register: promtail_binary_local_archive
delegate_to: localhost
run_once: True

- name: Assert local binary exists
assert:
that: promtail_binary_local_archive.stat.exists
msg: "When using 'promtail_binary_local_dir' please ensure that the binary exists"

when:
- promtail_binary_local_dir | length > 0

- block:
- name: "Get checksum list"
Expand All @@ -47,4 +56,3 @@
- "('promtail-linux-' + go_arch + '.zip') in item"
when:
- promtail_binary_local_dir | length == 0
- not promtail_binary_local_archive.stat.exists

0 comments on commit 7c7c4aa

Please sign in to comment.