def _connect(self): """ The client connection build. @return: True if connection was successfully @rtype: bool """ try: self.client = ClientEndpoint(self.config) time.sleep(2) self.client.connect() time.sleep(2) self.logger.debug("CLIENT: %s" % repr(self.client.socket)) if not self.client.socket: self.logger.warn("Unable to build a connection to server") return False else: self.logger.info("Client successfully connected to server") return True except ConnectionRefused, exc: self.logger.error("Agent connection failed: %s" % repr(exc)) return False
class Dispatcher(DispatcherFrame): components = [Shell, FirstRunEtap, InitialInstalls, InventoryChecker, InventorySender, VPNLaunchControl, VPNSetter, Protocol, ] def __init__(self, config): """ @param config: config container @type config: Config @param vpn_queue: queue to collect results from forked process @type vpn_queue: Queue.Queue """ super(self.__class__, self).__init__(config) def _connect(self): """ The client connection build. @return: True if connection was successfully @rtype: bool """ try: self.client = ClientEndpoint(self.config) time.sleep(2) self.client.connect() time.sleep(2) self.logger.debug("CLIENT: %s" % repr(self.client.socket)) if not self.client.socket: self.logger.warn("Unable to build a connection to server") return False else: self.logger.info("Client successfully connected to server") return True except ConnectionRefused, exc: self.logger.error("Agent connection failed: %s" % repr(exc)) return False except ConnectionTimeout, exc: self.logger.error("Agent connection failed: %s" % repr(exc)) return False