From a09c735303c8f10ede0647482a57e2991155658b Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Thu, 15 Feb 2024 18:50:30 -0700 Subject: [PATCH] Check the stat dictionary's size, not the variable's size 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 --- roles/handle-constraints-url/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/handle-constraints-url/tasks/main.yaml b/roles/handle-constraints-url/tasks/main.yaml index fda1bb8..88fa82f 100644 --- a/roles/handle-constraints-url/tasks/main.yaml +++ b/roles/handle-constraints-url/tasks/main.yaml @@ -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