Skip to content

Commit

Permalink
Merge pull request #320 from freyes/fix-pip_constraints_url
Browse files Browse the repository at this point in the history
Get the constraints file only when holds a valid value
  • Loading branch information
ajkavanagh authored Feb 15, 2024
2 parents eac4ec0 + 3bd7b26 commit f4736b0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions roles/handle-constraints-url/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@
path: /home/ubuntu/
prefix: "constraints."
suffix: ".txt"
when: pip_constraints_url is defined
register: constraints_file

- name: GET the constraints file
get_url:
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:
tox_constraints_env:
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

0 comments on commit f4736b0

Please sign in to comment.