-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule context can be modified within rule #526
Conversation
if rule.context: | ||
rule_result = rule.rule_function(record, rule.context) | ||
else: | ||
rule_result = rule.rule_function(record) | ||
except Exception: # pylint: disable=broad-except |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javuto I know this isn't part of your changes, but can you get rid of this except Exception:
line and just have this be try: ... except: ...
. This would get rid of that pylint disable message too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments that should be addressed but LGTM!
# process payloads | ||
alerts = self.rules_engine.process(payload) | ||
|
||
print alerts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rouge print statement should be removed
@rule(logs=['test_log_type_json_nested_with_data'], | ||
outputs=['s3:sample_bucket'], | ||
context={'assigned_user': 'not_set', 'assigned_policy': 'not_set2'}) | ||
def modify_context_test(rec, context): # pylint: disable=unused-variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't need this # pylint: disable=unused-variable
do you?
to: @ryandeivert @jacknagz
cc: @airbnb/streamalert-maintainers
size: small
Background
Context was added to rules to be able to extract information from the rule record and be utilized after (for example, outputs). This code makes that alteration possible and adds test for it.
Changes
Testing