Change tunnel telemetry format to fit expected structure

This commit is contained in:
Itay Mizeretz 2017-09-13 16:25:29 +03:00
parent 643b445199
commit 77f7e4c5a8
2 changed files with 3 additions and 3 deletions

View File

@ -86,7 +86,7 @@ class ChaosMonkey(object):
self._default_server = WormConfiguration.current_server
LOG.debug("default server: %s" % self._default_server)
ControlClient.send_telemetry("tunnel", ControlClient.proxies.get('https'))
ControlClient.send_telemetry("tunnel", {'proxy': ControlClient.proxies.get('https')})
if WormConfiguration.collect_system_info:
LOG.debug("Calling system info collection")

View File

@ -60,8 +60,8 @@ class Telemetry(flask_restful.Resource):
def process_tunnel_telemetry(self, telemetry_json):
monkey_id = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid'])["_id"]
if telemetry_json['data']:
host = telemetry_json['data'].split(":")[-2].replace("//", "")
if telemetry_json['data']['proxy'] is not None:
host = telemetry_json['data']['proxy'].split(":")[-2].replace("//", "")
tunnel_host_id = NodeService.get_monkey_by_ip(host)["_id"]
NodeService.set_monkey_tunnel(monkey_id, tunnel_host_id)
else: