Fix multiple file support in linux.file_watch.line + black + fstring #5467
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When multiple file_watch rules are defined, the last defined file reference is used for all files being watched. This causes trigger-instances to fail rule enforcement.
Adding the reference to the logging shows
test1.log
has the reference ending with8c505
When the file contents are updated a trigger is emitted by the sensor using the reference of
test2.log
ending inb030a9
This PR consists of adding a dictionary that is used to track the
path_name
andreference
pair and looks up the reference for the file that was altered when creating the trigger.The code is formatted with black and updated to use fstrings since all instances will be using Python 3.6+