From a18999e0029ee59adf4418b0c347d425632dca1b Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 5 Sep 2017 17:32:12 -0500 Subject: [PATCH] Don't install bindep if there's no bindep file Change-Id: I60f229f06e9655bead1f38a8e2d70c3048c0269b --- roles/bindep/tasks/find-bindep.yaml | 21 +++++++++++++++++++++ roles/bindep/tasks/main.yaml | 24 ++++-------------------- 2 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 roles/bindep/tasks/find-bindep.yaml diff --git a/roles/bindep/tasks/find-bindep.yaml b/roles/bindep/tasks/find-bindep.yaml new file mode 100644 index 000000000..502fb81d2 --- /dev/null +++ b/roles/bindep/tasks/find-bindep.yaml @@ -0,0 +1,21 @@ +- name: Look for bindep command + stat: + path: "{{ bindep_command }}" + when: bindep_command is defined + register: bindep_command_stat + +- name: Check for system bindep + args: + executable: /bin/bash + command: type -p bindep + failed_when: false + register: bindep_command_type + when: >- + bindep_command is not defined + or bindep_command_stat is defined + and not bindep_command_stat.stat.exists + +- name: Define bindep_command fact + set_fact: + bindep_command: "{{ bindep_command_type.stdout }}" + when: bindep_command_type|succeeded and not bindep_command_type|skipped diff --git a/roles/bindep/tasks/main.yaml b/roles/bindep/tasks/main.yaml index 2960dbd95..d7b70c3ea 100644 --- a/roles/bindep/tasks/main.yaml +++ b/roles/bindep/tasks/main.yaml @@ -1,29 +1,13 @@ --- -- name: Look for bindep command - stat: - path: "{{ bindep_command }}" - when: bindep_command is defined - register: bindep_command_stat +- include: find.yaml + when: bindep_file is not defined -- name: Check for system bindep - args: - executable: /bin/bash - command: type -p bindep - ignore_errors: yes - register: bindep_command_type - when: bindep_command is not defined or not bindep_command_stat.stat.exists - -- name: Define bindep_command fact - set_fact: - bindep_command: "{{ bindep_command_type.stdout }}" - when: bindep_command_type|succeeded and not bindep_command_type|skipped +- include: find-bindep.yaml + when: bindep_file is defined - include: install.yaml when: bindep_command is not defined -- include: find.yaml - when: bindep_file is not defined - - name: Define bindep_command fact set_fact: bindep_run: "{{ bindep_command }} -b -f {{ bindep_file }} {{ bindep_profile }}"