diff --git a/roles/handle-constraints-url/tasks/main.yaml b/roles/handle-constraints-url/tasks/main.yaml index 692bea4..7929143 100644 --- a/roles/handle-constraints-url/tasks/main.yaml +++ b/roles/handle-constraints-url/tasks/main.yaml @@ -3,7 +3,6 @@ path: /home/ubuntu/ prefix: "constraints." suffix: ".txt" - when: pip_constraints_url is defined register: constraints_file - name: GET the constraints file @@ -11,7 +10,12 @@ url: "{{ pip_constraints_url }}" dest: "{{ constraints_file.path }}" mode: 0444 - when: constraints_file is defined and pip_constraints_url is defined + when: constraints_file is defined and pip_constraints_url is defined and pip_constraints_url != null and pip_constraints_url|length > 0 + +- name: Get stat of temporary constraints file + ansible.builtin.stat: + path: "{{ constraints_file.path }}" + register: constraints_stat - name: Record file location set_fact: @@ -19,4 +23,4 @@ TOX_CONSTRAINTS_FILE: "{{ constraints_file.path }}" # Backward compatibility, to be removed UPPER_CONSTRAINTS_FILE: "{{ constraints_file.path }}" - when: constraints_file is defined and pip_constraints_url is defined + when: constraints_stat.size > 0