Skip to content

Commit

Permalink
Comply with flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian GAULTIER committed Oct 21, 2019
1 parent 70b8a4e commit f926dee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions elastalert/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import json
import logging
import os
import re
import subprocess
import sys
import time
Expand Down Expand Up @@ -2126,12 +2125,13 @@ def get_aggregation_summary_text(self, matches):

def create_artifacts(self, match):
artifacts = []
context = {'rule': self.rule, 'match': match}
for mapping in self.rule.get('hive_observable_data_mapping', []):
for observable_type, match_data_key in mapping.iteritems():
try:
artifacts.append(AlertArtifact(dataType=observable_type, data=match_data_key.format(**{'rule': self.rule, 'match': match})))
artifacts.append(AlertArtifact(dataType=observable_type, data=match_data_key.format(**context)))
except KeyError:
raise KeyError('\nformat string\n{}\nmatch data\n{}'.format(match_data_key, {'rule': self.rule, 'match': match}))
raise KeyError('\nformat string\n{}\nmatch data\n{}'.format(match_data_key, context))
return artifacts

def create_alert_config(self, match):
Expand Down

0 comments on commit f926dee

Please sign in to comment.