Hotfix telemetry feed accessing non-existent monkey_guid
This commit is contained in:
parent
f5b9c6fe46
commit
759cbcd6ae
|
@ -31,11 +31,13 @@ class TelemetryFeed(flask_restful.Resource):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_displayed_telemetry(telem):
|
def get_displayed_telemetry(telem):
|
||||||
|
monkey = NodeService.get_monkey_by_guid(telem['monkey_guid'])
|
||||||
|
default_hostname = "GUID-" + telem['monkey_guid']
|
||||||
return \
|
return \
|
||||||
{
|
{
|
||||||
'id': telem['_id'],
|
'id': telem['_id'],
|
||||||
'timestamp': telem['timestamp'].strftime('%d/%m/%Y %H:%M:%S'),
|
'timestamp': telem['timestamp'].strftime('%d/%m/%Y %H:%M:%S'),
|
||||||
'hostname': NodeService.get_monkey_by_guid(telem['monkey_guid']).get('hostname','missing'),
|
'hostname': monkey.get('hostname', default_hostname) if monkey else default_hostname,
|
||||||
'brief': TELEM_PROCESS_DICT[telem['telem_type']](telem)
|
'brief': TELEM_PROCESS_DICT[telem['telem_type']](telem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue