small fixes

This commit is contained in:
maor.rayzin 2018-11-29 17:43:53 +02:00
parent 498ddcacf5
commit 1cedfb5c2d
2 changed files with 3 additions and 2 deletions

View File

@ -194,7 +194,7 @@ class Telemetry(flask_restful.Resource):
if 'aws' in telemetry_json['data']:
if 'instance_id' in telemetry_json['data']['aws']:
mongo.db.monkey.update_one({'_id': monkey_id},
{'aws_instance_id': telemetry_json['data']['aws']['instance_id']})
{'$set': {'aws_instance_id': telemetry_json['data']['aws']['instance_id']}})
@staticmethod
def add_ip_to_ssh_keys(ip, ssh_info):

View File

@ -555,7 +555,8 @@ class ReportService:
def get_machine_aws_instance_id(hostname):
aws_instance_id_list = list(mongo.db.monkey.find({'hostname': hostname}, {'aws_instance_id': 1}))
if aws_instance_id_list:
return str(aws_instance_id_list[0].get('aws_instance_id', None))
if 'aws_instance_id' in aws_instance_id_list[0]:
return str(aws_instance_id_list[0]['aws_instance_id'])
else:
return None