Skip to content

Commit

Permalink
Merge pull request #247 from Tompage1994/fix/diff_plugin_errormsg
Browse files Browse the repository at this point in the history
Add error message for diff plugin
  • Loading branch information
sean-m-sullivan authored Dec 17, 2021
2 parents 9999150 + 2a49ee8 commit e6cb718
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugins/lookup/controller_object_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ def run(self, terms, variables=None, **kwargs):
keys_to_keep = ["name", "organization"]
api_keys_to_keep = ["name", "summary_fields"]

for item in compare_list:
for key in keys_to_keep:
if key not in item.keys():
self.handle_error(msg="Key: '{0}' missing from item in compare_list item: {1}".format(key, item))

for item in api_list:
for key in api_keys_to_keep:
if key not in item.keys():
self.handle_error(msg="Key: '{0}' missing from item in api_list. Does this object come from the api? item: {1}".format(key, item))

# Reduce list to name and organization
compare_list_reduced = [{key: item[key] for key in keys_to_keep} for item in compare_list]
api_list_reduced = [{key: item[key] for key in api_keys_to_keep} for item in api_list]
Expand Down

0 comments on commit e6cb718

Please sign in to comment.