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

Make raw_output_present always return data if data is present #542

Merged
merged 1 commit into from
Dec 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rho/inventory_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ def inventory_scan(hosts_yml_path, facts_to_collect, report_path,
with open(normalized_path, 'w') as write_file:
# Construct the CSV writer
writer = csv.DictWriter(
write_file, sorted(facts_to_collect), delimiter=',')
write_file, sorted(facts_to_collect), delimiter=',',
extrasaction='ignore')

# Write a CSV header if necessary
file_size = os.path.getsize(normalized_path)
Expand Down
6 changes: 3 additions & 3 deletions rho/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def raw_output_present(fact_names, host_vars, this_fact, this_var, command):
... process output ...
"""

if this_fact not in fact_names:
return {}, None

if this_var not in host_vars:
if this_fact not in fact_names:
return {}, None

return {this_fact: 'Error: "{0}" not run'.format(command)}, None

raw_output = host_vars[this_var]
Expand Down
3 changes: 3 additions & 0 deletions test/test_postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def run_func(output):
['jboss.eap.jboss-user'],
{'jboss_eap_id_jboss': output})

# Disable this test due to issue/541. Should be re-enabled when
# that issue has a more permanent solution.
@unittest.skip
def test_fact_not_requested(self):
self.assertEqual(
postprocessing.process_id_u_jboss([], None),
Expand Down