Skip to content

Commit

Permalink
Updated the update_results function to append any custom fields rathe…
Browse files Browse the repository at this point in the history
…r than overwriting them
  • Loading branch information
SamDesmondKing committed Jul 9, 2024
1 parent 6391fb5 commit 474f44a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion unix/src/machine_stats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,16 @@ def update_results(self, host, data: dict):

if host not in self._total_results:
self._total_results[host] = data
else:
return

# Ensure we append any custom fields, rather than overwriting them
if 'custom_fields' in data and 'custom_fields' in self._total_results[host]:
combined_custom_fields = {**self._total_results[host]['custom_fields'], **data['custom_fields']}
data['custom_fields'].update(combined_custom_fields)
self._total_results[host].update(data)
return

self._total_results[host].update(data)

def v2_runner_on_ok(self, result):
self._plugins.ok_callback(self, result)
Expand Down

0 comments on commit 474f44a

Please sign in to comment.