From 94dc8cf37785b3b9d1a8ca50d160df98d25a1d82 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 7 Sep 2022 19:00:51 +0530 Subject: [PATCH] Agent: Use `find_servers` to pass valid server to `ControlClient` --- monkey/infection_monkey/monkey.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 1af0266bb..2a70b763c 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -96,9 +96,11 @@ class InfectionMonkey: logger.info("Monkey is initializing...") self._singleton = SystemSingleton() self._opts = self._get_arguments(args) - # TODO: Change address to ip port to use list of servers - self._cmd_island_ip, self._cmd_island_port = address_to_ip_port(self._opts.servers) - self._control_client = ControlClient(self._opts.servers) + + server = find_server(self._opts.servers) + self._cmd_island_ip, self._cmd_island_port = address_to_ip_port(server) + self._control_client = ControlClient(server_address=server) + # TODO Refactor the telemetry messengers to accept control client # and remove control_client_object ControlClient.control_client_object = self._control_client