forked from p15670423/monkey
small fixes
This commit is contained in:
parent
498ddcacf5
commit
1cedfb5c2d
|
@ -194,7 +194,7 @@ class Telemetry(flask_restful.Resource):
|
||||||
if 'aws' in telemetry_json['data']:
|
if 'aws' in telemetry_json['data']:
|
||||||
if 'instance_id' in telemetry_json['data']['aws']:
|
if 'instance_id' in telemetry_json['data']['aws']:
|
||||||
mongo.db.monkey.update_one({'_id': monkey_id},
|
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
|
@staticmethod
|
||||||
def add_ip_to_ssh_keys(ip, ssh_info):
|
def add_ip_to_ssh_keys(ip, ssh_info):
|
||||||
|
|
|
@ -555,7 +555,8 @@ class ReportService:
|
||||||
def get_machine_aws_instance_id(hostname):
|
def get_machine_aws_instance_id(hostname):
|
||||||
aws_instance_id_list = list(mongo.db.monkey.find({'hostname': hostname}, {'aws_instance_id': 1}))
|
aws_instance_id_list = list(mongo.db.monkey.find({'hostname': hostname}, {'aws_instance_id': 1}))
|
||||||
if aws_instance_id_list:
|
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:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue