* Added the boto3 pckg to the right req'.txt file

* Added a safe dict key access for aws_instance_id in report.py
* Added a skip in the aws_export if there is no instance_id in the issue.
This commit is contained in:
maor.rayzin 2018-11-27 20:21:39 +02:00
parent e8c604d7c5
commit 2f1240cc0e
3 changed files with 4 additions and 2 deletions

View File

@ -26,7 +26,8 @@ class AWSExporter(Exporter):
return True
for machine in issues_list:
for issue in issues_list[machine]:
findings_list.append(AWSExporter._prepare_finding(issue))
if not issue.get('aws_instance_id', None):
findings_list.append(AWSExporter._prepare_finding(issue))
if not AWSExporter._send_findings(findings_list, AWSExporter._get_aws_keys()):
logger.error('Exporting findings to aws failed')

View File

@ -553,7 +553,7 @@ class ReportService:
@staticmethod
def get_machine_aws_instance_id(hostname):
return str(list(mongo.db.monkey.find({'hostname': hostname}, {'aws_instance_id': 1}))[0]['aws_instance_id'])
return str(list(mongo.db.monkey.find({'hostname': hostname}, {'aws_instance_id': 1}))[0].get('aws_instance_id', None))
@staticmethod
def get_issues():

View File

@ -14,4 +14,5 @@ netifaces
ipaddress
enum34
PyCrypto
boto3
virtualenv