Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into dev (#491)
Browse files Browse the repository at this point in the history
* Merge branch 'master' into dev

* master:
  Add jboss.eap.init-files to JBOSS_FACTS. Closes #478. (#479)
  Add default dictionaries to handle lost host. Handle ansible rc if csv was successfully created. Closes #475. (#476)
  Fix addition of certs for wrong when condition. Closes #472. (#474)
  Present more status during discovery for larger environments. Closes #442. (#467)
  revert default logging change. Closes #460. (#461)
  Check for empty vault password. Closes #444. (#457)
  Highlight potential issues in the console output. Closes #443. (#458)
  Default verbosity to 1 for improved log data. Closes #441. (#456)
  Turn off colors in the ansible log. Closes #448. (#455)
  Fix task that can hang if systemctl paginates
  Update playbook to use free strategy. Closes #445. (#453)
  Merge 0.30 version into master branch (#451)

# Conflicts:
#	rho/ansible_utils.py
#	rho/facts.py
#	rho/inventory_scan.py
#	rho/postprocessing.py
#	rho/scancommand.py
#	roles/jboss_eap/tasks/main.yml
#	roles/write/tasks/main.yml
#	test/test_postprocessing.py
  • Loading branch information
chambridge committed Nov 29, 2017
1 parent 3f86a39 commit 91ae258
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 17 deletions.
4 changes: 4 additions & 0 deletions rho/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ def process_jboss_eap_locate(fact_names, host_vars):
:returns: a dict of key, value pairs to add to the output.
"""

if not host_vars['have_locate']:
return {JBOSS_EAP_LOCATE_JBOSS_MODULES_JAR:
'N/A (locate not found)'}

err, output = raw_output_present(fact_names, host_vars,
JBOSS_EAP_LOCATE_JBOSS_MODULES_JAR,
'jboss_eap_locate_jboss_modules_jar',
Expand Down
27 changes: 27 additions & 0 deletions roles/check_dependencies/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,30 @@
- name: set have_virt_what
set_fact:
have_virt_what: "{{ have_virt_what_raw.rc == 0 }}"

- name: gather have_locate
raw: command -v locate
register: have_locate
ignore_errors: yes

- name: set have_locate
set_fact:
have_locate: "{{ have_locate.rc == 0 }}"

- name: gather have_systemctl
raw: command -v systemctl
register: have_systemctl
ignore_errors: yes

- name: set have_systemctl
set_fact:
have_systemctl: "{{ have_systemctl.rc == 0 }}"

- name: gather have_chkconfig
raw: command -v chkconfig
register: have_chkconfig
ignore_errors: yes

- name: set have_chkconfig
set_fact:
have_chkconfig: "{{ have_chkconfig.rc == 0 }}"
10 changes: 5 additions & 5 deletions roles/date/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@

- name: gather date.anaconda_log fact
raw: ls --full-time /root/anaconda-ks.cfg | grep -o '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}'
register: date_anaconda_log
register: date_anaconda_log_cmd
become: yes
ignore_errors: yes
when: '"date.anaconda_log" in facts_to_collect'

- name: extract result value for date.anaconda_log
set_fact:
date_anaconda_log: "{{ date_anaconda_log['stdout'] | trim | default('error') }}"
when: '"date.anaconda_log" in facts_to_collect and "stdout" in date_anaconda_log'
date_anaconda_log: "{{ date_anaconda_log_cmd['stdout'] | trim | default('error') }}"
when: '"date.anaconda_log" in facts_to_collect and "stdout" in date_anaconda_log_cmd'

- name: handle failure value for date.anaconda_log
set_fact:
date_anaconda_log: "error"
when: '"date.anaconda_log" in facts_to_collect and "stdout" not in date_anaconda_log'
when: '"date.anaconda_log" in facts_to_collect and "stdout" not in date_anaconda_log_cmd'

- name: add date.anaconda_log to dictionary
set_fact:
Expand All @@ -55,7 +55,7 @@
when: '"date.machine_id" in facts_to_collect'

- name: gather date.filesystem_create fact
raw: fs_date=$(tune2fs -l $(mount | egrep '/ type' | grep -o '/dev.* on' | sed -e 's/\on//g') | grep 'Filesystem created' | sed 's/Filesystem created:\s*//g'); if [[ $fs_date ]]; then date +'%F' -d \"$fs_date\"; else echo "" ; fi
raw: fs_date=$(tune2fs -l $(mount | egrep '/ type' | grep -o '/dev.* on' | sed -e 's/\on//g') 2> /dev/null | grep 'Filesystem created' | sed 's/Filesystem created:\s*//g'); if [[ $fs_date ]]; then date +'%F' -d \"$fs_date\"; else echo "" ; fi
register: date_filesystem_create
ignore_errors: yes
when: 'have_tune2fs and "date.filesystem_create" in facts_to_collect'
Expand Down
8 changes: 4 additions & 4 deletions roles/jboss_eap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
raw: locate jboss-modules.jar | xargs -n 1 dirname
register: jboss_eap_locate_jboss_modules_jar
ignore_errors: yes
when: '"jboss.eap.locate-jboss-modules-jar" in facts_to_collect or "jboss.eap.eap-home" in facts_to_collect or "jboss.fuse.fuse-on-eap" in facts_to_collect'
when: 'have_locate and ("jboss.eap.locate-jboss-modules-jar" in facts_to_collect or "jboss.eap.eap-home" in facts_to_collect or "jboss.fuse.fuse-on-eap" in facts_to_collect)'

# Combine the outputs of the above into a single fact

Expand Down Expand Up @@ -104,14 +104,14 @@
ignore_errors: yes
when: '"jboss.eap.jboss-user" in facts_to_collect'
- name: look for jboss systemd service
raw: systemctl list-unit-files
raw: systemctl list-unit-files --no-pager
register: jboss_eap_systemctl_unit_files
ignore_errors: yes
become: true
when: '"jboss.eap.init-files" in facts_to_collect'
when: 'have_systemctl and "jboss.eap.init-files" in facts_to_collect'
- name: look for jboss in chkconfig
raw: chkconfig
register: jboss_eap_chkconfig
ignore_errors: yes
become: true
when: '"jboss.eap.init-files" in facts_to_collect'
when: 'have_chkconfig and "jboss.eap.init-files" in facts_to_collect'
12 changes: 6 additions & 6 deletions roles/jboss_fuse_on_karaf/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# we get duplicate karaf_home entries when one has a trailing
# slash and the other doesn't, even without actual symlinks.

raw: ps -A -o args | egrep --invert-match '(^sed)|(\| sed)' | sed -n -e 's/.*-Dkaraf.base=\([^[:space:]]*\).*/\1/pg;s/.*-Dkaraf.home=\([^[:space:]]*\).*/\1/pg' | xargs -n 1 realpath
raw: ps -A -o args | egrep --invert-match '(^sed)|(\| sed)' | sed -n -e 's/.*-Dkaraf.base=\([^[:space:]]*\).*/\1/pg;s/.*-Dkaraf.home=\([^[:space:]]*\).*/\1/pg' | xargs -n 1 realpath 2> /dev/null
register: karaf_running_processes
ignore_errors: yes
when: '"jboss.fuse-on-karaf.karaf-home" in facts_to_collect'
Expand All @@ -37,10 +37,10 @@
# to get the KARAF_HOME. Just like the last task, we also use
# realpath to normalize paths.

raw: locate karaf.jar | sed -n -e 's/\(.*\)lib\/karaf\.jar$/\1/p' | xargs -n 1 realpath
raw: locate karaf.jar | sed -n -e 's/\(.*\)lib\/karaf\.jar$/\1/p' | xargs -n 1 realpath 2> /dev/null
register: karaf_locate_karaf_jar
ignore_errors: yes
when: '"jboss.fuse-on-karaf.karaf-home" in facts_to_collect'
when: 'have_locate and "jboss.fuse-on-karaf.karaf-home" in facts_to_collect'

# Combine the outputs of the above into a single fact

Expand Down Expand Up @@ -75,11 +75,11 @@
register: jboss_fuse_systemctl_unit_files
ignore_errors: yes
become: true
when: '"jboss.fuse.init-files" in facts_to_collect'
when: 'have_systemctl and "jboss.fuse.init-files" in facts_to_collect'

- name: look for fuse in chkconfig
raw: chkconfig | grep fuse
raw: chkconfig 2> /dev/null | grep fuse
register: jboss_fuse_chkconfig
ignore_errors: yes
become: true
when: '"jboss.fuse.init-files" in facts_to_collect'
when: 'have_chkconfig and "jboss.fuse.init-files" in facts_to_collect'
7 changes: 6 additions & 1 deletion roles/redhat_packages/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@
- 'redhat-packages.results'
when: gather_redhat_packages

- name: initialize redhat-packages.certs fact
set_fact:
redhat_packages_certs: ''
when: gather_certs

- name: gather redhat-packages.certs fact
raw: ls /etc/pki/product/ | grep '.pem'
register: redhat_packages_certs_cmd
Expand All @@ -155,4 +160,4 @@
redhat_packages: "{{ redhat_packages|default({}) | combine({ item: redhat_packages_certs }) }}"
with_items:
- 'redhat-packages.certs'
when: gather_redhat_packages
when: gather_certs
3 changes: 2 additions & 1 deletion test/test_postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ class TestProcessJbossLocateJbossModulesJar(unittest.TestCase):
def run_expect_well_formed(self, output):
val = postprocessing.process_jboss_eap_locate(
[postprocessing.JBOSS_EAP_LOCATE_JBOSS_MODULES_JAR],
{'jboss_eap_locate_jboss_modules_jar': output})
{'jboss_eap_locate_jboss_modules_jar': output,
'have_locate': True})

self.assertIsInstance(val, dict)
self.assertEqual(len(val), 1)
Expand Down

0 comments on commit 91ae258

Please sign in to comment.