This repository has been archived by the owner on Jun 29, 2022. It is now read-only.
forked from candlepin/rho
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error messages for missing programs
Check whether programs we need (like dmidecode and tune2fs) are present on the remote machine before running commands that depend on them. If they aren't present, we give report messages like "N/A (dmidecode not found)" instead of propagating a shell error message to the output. This also adds a file to the documentation listing exactly what executables are needed for each set of facts. We do not explicitly check for standard Unix things like grep and sed, so if those are missing we would still give a shell error, but the documentation lists all of the programs we need.
- Loading branch information
Noah Lavine
committed
Sep 1, 2017
1 parent
619d800
commit 94ac3eb
Showing
14 changed files
with
238 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--------------- | ||
Remote Programs | ||
--------------- | ||
|
||
This file documents which programs on the remote host are used to | ||
collect different groups of facts. **bold** is used for executables | ||
that are not standard Unix programs (i.e. not grep, sed, etc.). In | ||
addition to the programs below, we depend on standard shell facilities | ||
like those provided by bash. | ||
|
||
- brms.* | ||
- find | ||
- sed | ||
- sort | ||
- grep / egrep | ||
- cpu.* | ||
- cat | ||
- grep | ||
- sed | ||
- wc | ||
- **/usr/sbin/dmidecode** | ||
- date.* | ||
- date | ||
- ls | ||
- grep / egrep | ||
- **tune2fs** | ||
- mount | ||
- sed | ||
- **yum** | ||
- tail | ||
- dmi.* | ||
- **/usr/sbin/dmidecode** | ||
- grep | ||
- sed | ||
- etc_release.* | ||
- cat | ||
- uname | ||
- file_contents.* | ||
- cat | ||
- jboss.fuse.* | ||
- find | ||
- sed | ||
- sort | ||
- echo | ||
- jboss.* (facts one level down from jboss) | ||
- find | ||
- grep | ||
- **java** | ||
- sed | ||
- stat | ||
- df | ||
- tail | ||
- ls | ||
- sort | ||
- redhat_packages | ||
- **rpm** | ||
- redhat_release.* | ||
- **rpm** | ||
- subman.* | ||
- **subscription-manager** | ||
- grep | ||
- sed | ||
- ls | ||
- wc | ||
- uname.* | ||
- uname | ||
- virt.* | ||
- command | ||
- **virsh** | ||
- ps | ||
- grep | ||
- wc | ||
- **/usr/sbin/dmidecode** | ||
- sed | ||
- cat | ||
- virt_what.* | ||
- command | ||
- **virt-what** | ||
- echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
hosts: all | ||
gather_facts: no | ||
roles: | ||
- check_for_programs | ||
- connection | ||
- cpu | ||
- date | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
|
||
- name: gather have_dmidecode_raw | ||
raw: command -v /usr/sbin/dmidecode | ||
register: have_dmidecode_raw | ||
ignore_errors: yes | ||
|
||
- name: set have_dmidecode | ||
set_fact: | ||
have_dmidecode: "{{ have_dmidecode_raw.rc == 0 }}" | ||
|
||
- name: gather have_tune2fs_raw | ||
raw: command -v tune2fs | ||
register: have_tune2fs_raw | ||
ignore_errors: yes | ||
|
||
- name: set have_tune2fs | ||
set_fact: | ||
have_tune2fs: "{{ have_tune2fs_raw.rc == 0 }}" | ||
|
||
- name: gather have_yum_raw | ||
raw: command -v yum | ||
register: have_yum_raw | ||
ignore_errors: yes | ||
|
||
- name: set have_yum | ||
set_fact: | ||
have_yum: "{{ have_yum_raw.rc == 0 }}" | ||
|
||
- name: gather have_java_raw | ||
raw: command -v java | ||
register: have_java_raw | ||
ignore_errors: yes | ||
|
||
- name: set have_java | ||
set_fact: | ||
have_java: "{{ have_java_raw.rc == 0 }}" | ||
|
||
- name: gather have_rpm_raw | ||
raw: command -v rpm | ||
register: have_rpm_raw | ||
ignore_errors: yes | ||
|
||
- name: set have_rpm | ||
set_fact: | ||
have_rpm: "{{ have_rpm_raw.rc == 0 }}" | ||
|
||
- name: gather have_subscription_manager_raw | ||
raw: command -v subscription-manager | ||
register: have_subscription_manager_raw | ||
ignore_errors: yes | ||
|
||
- name: set have_subscription_manager | ||
set_fact: | ||
have_subscription_manager: "{{ have_subscription_manager_raw.rc == 0 }}" | ||
|
||
- name: gather have_virsh_raw | ||
raw: command -v virsh | ||
register: have_virsh_raw | ||
ignore_errors: yes | ||
|
||
- name: set have_virsh | ||
set_fact: | ||
have_virsh: "{{ have_virsh_raw.rc == 0 }}" | ||
|
||
- name: gather have_virt_what_raw | ||
raw: command -v virt-what | ||
register: have_virt_what_raw | ||
ignore_errors: yes | ||
|
||
- name: set have_virt_what | ||
set_fact: | ||
have_virt_what: "{{ have_virt_what_raw.rc == 0 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.