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

Commit

Permalink
update JBoss processing flow to capture values in csv output. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
chambridge committed Aug 3, 2017
1 parent 7deac05 commit 60da19d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
22 changes: 14 additions & 8 deletions library/spit_results.py
Expand Up @@ -82,7 +82,8 @@
'1.3.6.Final-redhat-1': 'EAP-6.4',
'1.3.7.Final-redhat-1': 'EAP-6.4',
'1.4.4.Final-redhat-1': 'EAP-7.0',
'1.5.1.Final-redhat-1': 'EAP-7.0'
'1.5.1.Final-redhat-1': 'EAP-7.0',
'1.5.4.Final-redhat-1': 'EAP-7.0'
}

BRMS_CLASSIFICATIONS = {
Expand Down Expand Up @@ -144,6 +145,7 @@ def process_jboss_versions(host_vars):
"""Get JBoss version information from the host_vars."""

lines = []
val = {}

# host_vars is not used after this function (data that we return
# is copied to host_vals instead), so by not returning
Expand All @@ -153,25 +155,29 @@ def process_jboss_versions(host_vars):
lines.extend(host_vars['jboss.jar-ver']['stdout_lines'])
if 'jboss.run-jar-ver' in host_vars:
lines.extend(host_vars['jboss.run-jar-ver']['stdout_lines'])
if 'jboss.running-versions' in host_vars:
running_ver = 'jboss.running-versions'
val[running_ver] = host_vars[running_ver]['stdout']

jboss_releases = []
deploy_dates = []
for line in lines:
if line:
version, deploy_date = line.split('**')
line_format = line.split('**')
version = line_format[0]
deploy_date = line_format[-1]
deploy_dates.append(deploy_date)
if version in EAP_CLASSIFICATIONS:
jboss_releases.append(EAP_CLASSIFICATIONS[version])
elif version.strip():
jboss_releases.append('Unknown-Release: ' + version)

if not jboss_releases:
return {}
return val

return {
'jboss.installed-versions': '; '.join(jboss_releases),
'jboss.deploy-dates': '; '.join(deploy_dates)
}
val['jboss.installed-versions'] = '; '.join(jboss_releases)
val['jboss.deploy-dates'] = '; '.join(deploy_dates)
return val


def classify_releases(lines, classifications):
Expand Down Expand Up @@ -395,7 +401,7 @@ def write_to_csv(self):
try:
# Special processing for JBoss facts.
for _, host_vars in iteritems(self.all_vars):
uuid = host_vars['connection.uuid']
uuid = host_vars['connection']['connection.uuid']
host_vals = safe_next((vals
for vals in self.vals
if vals['connection.uuid'] == uuid))
Expand Down
5 changes: 4 additions & 1 deletion test/test_spit_results.py
Expand Up @@ -44,7 +44,10 @@ def test__main__success(self, ansible_mod_cls):
{'fact1': 'value1',
'fact2': 'value2',
'res': {'fact3': 'value3'},
'connection.uuid': '1'}},
'connection:': {'connection.uuid': '1'},
'jboss.jar-ver':
{'stdout_lines':
['1.5.4.Final-redhat-1**2017-08-03']}}},
"fact_names": ['fact1', 'connection.uuid',
'systemid.username',
'redhat-packages.last_built']
Expand Down

0 comments on commit 60da19d

Please sign in to comment.