From 77f7e4c5a8ca10c632f227d062dcce6e15886598 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Wed, 13 Sep 2017 16:25:29 +0300 Subject: [PATCH] Change tunnel telemetry format to fit expected structure --- chaos_monkey/monkey.py | 2 +- monkey_island/cc/resources/telemetry.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chaos_monkey/monkey.py b/chaos_monkey/monkey.py index 6e128ed67..99298ebfd 100644 --- a/chaos_monkey/monkey.py +++ b/chaos_monkey/monkey.py @@ -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") diff --git a/monkey_island/cc/resources/telemetry.py b/monkey_island/cc/resources/telemetry.py index 3150717f4..2a057f626 100644 --- a/monkey_island/cc/resources/telemetry.py +++ b/monkey_island/cc/resources/telemetry.py @@ -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: