Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prior to this change, the `com` bucket of events alerted with an alert plugin looked like the following example: "com": { "record_type": "mock_event", "origin_worker": "mockaudit-mockevent", "origin_type": "event", "event_worker": "mockaudit-mockevent", "store_worker": "mockaudit-filestore" } Note that the last key in the example above is named as `store_worker` although alerting is done by alert plugins. This was so because store plugins and alert plugins implement the exact same interface via duck-typing, so both types of plugins were worked on by a function named `store_worker`. While this makes sense for us (the developers), finding a `store_worker` key in data written by an alert plugin could be confusing to a user. Therefore, with this change, the `com` bucket of events alerted with an alert plugin looks like this: "com": { "record_type": "mock_event", "origin_worker": "mockaudit-mockevent", "origin_type": "event", "event_worker": "mockaudit-mockevent", "alert_worker": "mockaudit-filestore" } To accomplish this behaviour, `workers.py` has been refactored by moving the existing `store_worker` functionality to an internal `_write_worker` function which can work on both store and alert plugins. It accepts an additional parameter that tells it whether to populate `store_worker` or `alert_worker` in the `com` bucket. Now there are two functions `store_worker` and `alert_worker` which invoke with the `_write_worker` function with the additional parameter to populate the `com` bucket appropriately.
- Loading branch information