lacework / extensible-reporting

A command line tool for generating Lacework Reports
12 stars 4 forks source link

CSA Report script fails when there are no critical compliance findings. #57

Closed aaronkornhauser closed 2 years ago

aaronkornhauser commented 2 years ago

@jvogt

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3803, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 146, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index_class_helper.pxi", line 49, in pandas._libs.index.Int64Engine._check_type KeyError: 'Critical'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/akornhauser/Documents/Lacework/git_repos/extensible-reporting/./generate_csa_report.py", line 82, in main() File "/Users/akornhauser/Documents/Lacework/git_repos/extensible-reporting/./generate_csa_report.py", line 79, in main report.generate_report(_shared(), report_save_path=report_save_path, use_cached_data=args.use_cached_data) File "/Users/akornhauser/Documents/Lacework/git_repos/extensible-reporting/reports/jinja2/csa_report.py", line 21, in generate_report compliance_data = gather_compliance_data(_shared, lw_provider) File "/Users/akornhauser/Documents/Lacework/git_repos/extensible-reporting/reports/jinja2/csa_report.py", line 136, in gather_compliance_data critical_finding_count = compliance_findings_summary_for_graphic['Critical'].sum() File "/usr/local/lib/python3.9/site-packages/pandas/core/frame.py", line 3804, in getitem indexer = self.columns.get_loc(key) File "/usr/local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc raise KeyError(key) from err KeyError: 'Critical'

DanielSobikLW commented 2 years ago

I got the same error

Traceback (most recent call last): File "/Users/danielsobik/Library/Python/3.8/lib/python/site-packages/pandas/core/indexes/base.py", line 3803, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 146, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index_class_helper.pxi", line 49, in pandas._libs.index.Int64Engine._check_type KeyError: 'Critical'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "./generate_csa_report.py", line 82, in main() File "./generate_csa_report.py", line 79, in main report.generate_report(_shared(), report_save_path=report_save_path, use_cached_data=args.use_cached_data) File "/Users/danielsobik/CSA/extensible-reporting-main/reports/jinja2/csa_report.py", line 21, in generate_report compliance_data = gather_compliance_data(_shared, lw_provider) File "/Users/danielsobik/CSA/extensible-reporting-main/reports/jinja2/csa_report.py", line 136, in gather_compliance_data critical_finding_count = compliance_findings_summary_for_graphic['Critical'].sum() File "/Users/danielsobik/Library/Python/3.8/lib/python/site-packages/pandas/core/frame.py", line 3804, in getitem indexer = self.columns.get_loc(key) File "/Users/danielsobik/Library/Python/3.8/lib/python/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc raise KeyError(key) from err KeyError: 'Critical'

jvogt commented 2 years ago

Closed by #58