Example #1
0
 def __get_hermes_address_from_remote_courier(self):
     remote_connection = remote.create_remote_connection_to_http(
         self.destination_dict['address'],
         self.__get_ssh_tunnel(),
         health_check_url='/health',
     )
     try:
         remote_connection.start()
         courier_address = remote_connection.get_address()
         return _get_remote_hermes_address(courier_address, override_host_in_header=self.destination_dict['address'])
     finally:
         remote_connection.terminate()
Example #2
0
 def __get_hermes_address_from_remote_courier(self):
     remote_connection = remote.create_remote_connection_to_http(
         self.destination_dict['address'],
         self.__get_ssh_tunnel(),
         health_check_url='/health',
     )
     try:
         remote_connection.start()
         courier_address = remote_connection.get_address()
         return _get_remote_hermes_address(
             courier_address,
             override_host_in_header=self.destination_dict['address'])
     finally:
         remote_connection.terminate()
Example #3
0
 def __update_remote_courier(self):
     remote_connection = remote.create_remote_connection_to_http(
         self.destination_dict['address'],
         self.__get_ssh_tunnel(),
         health_check_url='/health',
     )
     try:
         remote_connection.start()
         courier_address = remote_connection.get_address()
         logging.info('Remote Courier address for update: {}'.format(courier_address))
         url = 'http://{}/update_all'.format(courier_address)
         headers = {'Host': self.destination_dict['address']}
         response = requests.post(url, headers=headers)
         if response.status_code != requests.codes.ok:
             logging.error('Could not execute /update_all on remote Courier: {url}.\n'
                           'HTTP code: {response.status_code}\n'
                           'Response:\n{response.text}'.format(**locals()))
             self.were_errors = True
     finally:
         remote_connection.terminate()
Example #4
0
 def __update_remote_courier(self):
     remote_connection = remote.create_remote_connection_to_http(
         self.destination_dict['address'],
         self.__get_ssh_tunnel(),
         health_check_url='/health',
     )
     try:
         remote_connection.start()
         courier_address = remote_connection.get_address()
         logging.info('Remote Courier address for update: {}'.format(
             courier_address))
         url = 'http://{}/update_all'.format(courier_address)
         headers = {'Host': self.destination_dict['address']}
         response = requests.post(url, headers=headers)
         if response.status_code != requests.codes.ok:
             logging.error(
                 'Could not execute /update_all on remote Courier: {url}.\n'
                 'HTTP code: {response.status_code}\n'
                 'Response:\n{response.text}'.format(**locals()))
             self.were_errors = True
     finally:
         remote_connection.terminate()