def ComponentProxy(url, user=None, password=None, key=None, cert=None, ca=None, allowedServerCNs=None, timeout=90, retries=3, delay=1): """Constructs proxies to components. Arguments: component_name -- name of the component to connect to Additional arguments are passed to the ServerProxy constructor. """ xmlrpclib._Method.max_retries = retries xmlrpclib._Method.retry_delay = delay if user and password: method, path = urlparse(url)[:2] newurl = "%s://%s:%s@%s" % (method, quote_plus( user, ''), quote_plus(password, ''), path) else: newurl = url ssl_trans = XMLRPCTransport(key, cert, ca, allowedServerCNs, timeout=float(timeout)) return xmlrpclib.ServerProxy(newurl, allow_none=True, transport=ssl_trans)
def __init__(self): RetryMethod.max_retries = Bcfg2.Options.setup.retries RetryMethod.retry_delay = Bcfg2.Options.setup.retry_delay if Bcfg2.Options.setup.user and Bcfg2.Options.setup.password: method, path = urlparse(Bcfg2.Options.setup.server)[:2] url = "%s://%s:%s@%s" % ( method, quote_plus(Bcfg2.Options.setup.user, ''), quote_plus(Bcfg2.Options.setup.password, ''), path) else: url = Bcfg2.Options.setup.server ssl_trans = XMLRPCTransport(Bcfg2.Options.setup.key, Bcfg2.Options.setup.cert, Bcfg2.Options.setup.ca, Bcfg2.Options.setup.ssl_cns, Bcfg2.Options.setup.client_timeout) xmlrpclib.ServerProxy.__init__(self, url, allow_none=True, transport=ssl_trans)
def ComponentProxy(url, user=None, password=None, key=None, cert=None, ca=None, allowedServerCNs=None, timeout=90, retries=3, delay=1): """Constructs proxies to components. Arguments: component_name -- name of the component to connect to Additional arguments are passed to the ServerProxy constructor. """ xmlrpclib._Method.max_retries = retries xmlrpclib._Method.retry_delay = delay if user and password: method, path = urlparse(url)[:2] newurl = "%s://%s:%s@%s" % (method, quote_plus(user, ''), quote_plus(password, ''), path) else: newurl = url ssl_trans = XMLRPCTransport(key, cert, ca, allowedServerCNs, timeout=float(timeout)) return xmlrpclib.ServerProxy(newurl, allow_none=True, transport=ssl_trans)