forked from p34709852/monkey
* add the right key in telemetry
* added error handling in report.py
This commit is contained in:
parent
0fe7a9c6e1
commit
9d36cf3990
|
@ -192,7 +192,8 @@ class Telemetry(flask_restful.Resource):
|
|||
wmi_handler = WMIHandler(monkey_id, telemetry_json['data']['wmi'], users_secrets)
|
||||
wmi_handler.process_and_handle_wmi_info()
|
||||
if 'aws' in telemetry_json['data']:
|
||||
mongo.db.monkey.update_one({'_id': monkey_id}, {'aws_instance_id': telemetry_json['data']['instance-id']})
|
||||
mongo.db.monkey.update_one({'_id': monkey_id},
|
||||
{'aws_instance_id': telemetry_json['data']['aws']['instance-id']})
|
||||
|
||||
@staticmethod
|
||||
def add_ip_to_ssh_keys(ip, ssh_info):
|
||||
|
|
|
@ -553,7 +553,11 @@ class ReportService:
|
|||
|
||||
@staticmethod
|
||||
def get_machine_aws_instance_id(hostname):
|
||||
return str(list(mongo.db.monkey.find({'hostname': hostname}, {'aws_instance_id': 1}))[0].get('aws_instance_id', None))
|
||||
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))
|
||||
else:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def get_issues():
|
||||
|
|
Loading…
Reference in New Issue