Agent: Use `find_servers` to pass valid server to `ControlClient`

This commit is contained in:
Shreya Malviya 2022-09-07 19:00:51 +05:30 committed by Mike Salvatore
parent 18659b654f
commit 94dc8cf377
1 changed files with 5 additions and 3 deletions

View File

@ -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