def _connect(self, rpc_path): # This does not fail even if the address is wrong. # We need to wait for an actual RPC to fail headers = rpc_client_lib.authorization_headers(self.username, self.web_server) rpc_server = self.web_server + rpc_path return rpc_client_lib.get_proxy(rpc_server, headers=headers)
def __init__(self, path, user, server, print_log, debug, reply_debug): """ Create a cached instance of a connection to the frontend user: username to connect as server: frontend server to connect to print_log: pring a logging message to stdout on every operation debug: print out all RPC traffic """ if not user: user = getpass.getuser() if not server: if 'AUTOTEST_WEB' in os.environ: server = os.environ['AUTOTEST_WEB'] else: server = GLOBAL_CONFIG.get_config_value('SERVER', 'hostname', default=DEFAULT_SERVER) self.server = server self.user = user self.print_log = print_log self.debug = debug self.reply_debug = reply_debug http_server = 'http://' + server headers = rpc_client_lib.authorization_headers(user, http_server) rpc_server = http_server + path if debug: print 'SERVER: %s' % rpc_server print 'HEADERS: %s' % headers self.proxy = rpc_client_lib.get_proxy(rpc_server, headers=headers)
def __init__(self, path, user, server, print_log, debug, reply_debug): """ Create a cached instance of a connection to the frontend user: username to connect as server: frontend server to connect to print_log: pring a logging message to stdout on every operation debug: print out all RPC traffic """ if not user and utils.is_in_container(): user = GLOBAL_CONFIG.get_config_value('SSP', 'user', default=None) if not user: user = getpass.getuser() if not server: if 'AUTOTEST_WEB' in os.environ: server = os.environ['AUTOTEST_WEB'] else: server = GLOBAL_CONFIG.get_config_value('SERVER', 'hostname', default=DEFAULT_SERVER) self.server = server self.user = user self.print_log = print_log self.debug = debug self.reply_debug = reply_debug headers = {'AUTHORIZATION': self.user} rpc_server = rpc_client_lib.add_protocol(server) + path if debug: print 'SERVER: %s' % rpc_server print 'HEADERS: %s' % headers self.proxy = rpc_client_lib.get_proxy(rpc_server, headers=headers)
def _connect(self, rpc_path): # This does not fail even if the address is wrong. # We need to wait for an actual RPC to fail if self.username: username = self.username elif 'AUTOTEST_USER' in os.environ: username = os.environ['AUTOTEST_USER'] else: username = getpass.getuser() headers = {'AUTHORIZATION' : username} rpc_server = self.web_server + rpc_path return rpc_client_lib.get_proxy(rpc_server, headers=headers)