From b318de6cc6acd8b047f0750d8f171ad929d0e15e Mon Sep 17 00:00:00 2001 From: Ryan Deivert Date: Wed, 12 Jul 2017 13:45:11 -0700 Subject: [PATCH] [lambda][rule] fixing bug that caused rule imports to break in some cases --- stream_alert/rule_processor/main.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stream_alert/rule_processor/main.py b/stream_alert/rule_processor/main.py index 7bc12c1e1..92aa1d334 100644 --- a/stream_alert/rule_processor/main.py +++ b/stream_alert/rule_processor/main.py @@ -21,16 +21,12 @@ modules_to_import = set() # walk the rules directory to dymanically import -for folder in ('matchers/', 'rules/'): +for folder in ('matchers', 'rules'): for root, dirs, files in os.walk(folder): filtered_files = [rule_file for rule_file in files if not (rule_file.startswith(( '.', '__init__')) or rule_file.endswith('.pyc'))] + package_path = root.replace('/', '.') for import_file in filtered_files: - # Greater than one because that indicates there's only one folder - if root.count('/') > 1: - package_path = root.replace('/', '.') - else: - package_path = root.rstrip('/') import_module = os.path.splitext(import_file)[0] if package_path and import_module: modules_to_import.add('{}.{}'.format(package_path, import_module))