Skip to content

Commit

Permalink
Check the stat dictionary's size, not the variable's size
Browse files Browse the repository at this point in the history
The ansible.builtin.stat module returns a dictionary where the
key to use is 'stat' in order to get the file stats. Add the
missing stat key. Failure to do this causes the task to fail
with size not being a key in the dictionary.

ref: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/stat_module.html#ansible-collections-ansible-builtin-stat-module
  • Loading branch information
wolsen committed Feb 16, 2024
1 parent c84cb32 commit a09c735
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion roles/handle-constraints-url/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
TOX_CONSTRAINTS_FILE: "{{ constraints_file.path }}"
# Backward compatibility, to be removed
UPPER_CONSTRAINTS_FILE: "{{ constraints_file.path }}"
when: constraints_stat.size > 0
when: constraints_file is defined and constraints_stat.size > 0

0 comments on commit a09c735

Please sign in to comment.