Make sure bindep is on the node
OpenStack nodes pre-install bindep, but other nodes may not. Check to see if bindep is on the node. If so, use it. If not, make a temp dir that we remove at the end of the role and install bindep into a virtualenv in that tempdir. Change-Id: I3f34c178254add2143dc7f1b9758844480d7d914
This commit is contained in:
parent
ab6e3f5fd9
commit
1ba3e583f3
@ -1,2 +1,4 @@
|
||||
---
|
||||
zuul_work_dir: "src/{{ zuul.project.canonical_name }}"
|
||||
bindep_command: /usr/bindep-env/bin/bindep
|
||||
bindep_file: ""
|
||||
|
4
roles/bindep/handlers/main.yaml
Normal file
4
roles/bindep/handlers/main.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
- name: remove bindep temp dir
|
||||
file:
|
||||
path: "{{ bindep_temp_dir }}"
|
||||
state: absent
|
15
roles/bindep/tasks/install.yaml
Normal file
15
roles/bindep/tasks/install.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
- name: create temp dir for bindep
|
||||
tempfile:
|
||||
state: directory
|
||||
prefix: bindep
|
||||
register: bindep_temp_dir
|
||||
notify:
|
||||
- remove bindep temp dir
|
||||
|
||||
- name: install bindep into temporary venv
|
||||
pip:
|
||||
name: bindep
|
||||
virtualenv: "{{ bindep_temp_dir }}/venv"
|
||||
|
||||
- set_fact:
|
||||
bindep_found_command: "{{ bindep_temp_dir }}/venv/bin/bindep"
|
@ -1,12 +1,24 @@
|
||||
---
|
||||
- stat:
|
||||
path: "{{ bindep_command }}"
|
||||
register: bindep_command_stat
|
||||
failed_when: false
|
||||
|
||||
- set_fact:
|
||||
bindep_found_command: "{{ bindep_command }}"
|
||||
when: bindep_command_stat is defined
|
||||
|
||||
- include: install.yaml
|
||||
when: bindep_command_stat is not defined
|
||||
|
||||
- name: Install distro packages from bindep
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
executable: /bin/bash
|
||||
environment:
|
||||
BINDEP: "{{ bindep_command }}"
|
||||
PACKAGES: "{{ bindep_file }}"
|
||||
shell: |
|
||||
# set a default path to the preinstalled bindep entrypoint
|
||||
export BINDEP=${BINDEP:-/usr/bindep-env/bin/bindep}
|
||||
|
||||
function is_fedora {
|
||||
[ -f /usr/bin/yum ] && cat /etc/*release | grep -q -e "Fedora"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user