예제 #1
0
파일: agent.py 프로젝트: sebastiendu/mmc
    def startService(self, mod):
        # Starting XMLRPC server
        r = MmcServer(mod, self.config)
        if self.config.enablessl:
            sslContext = makeSSLContext(self.config.verifypeer, self.config.cacert, self.config.localcert)
            reactor.listenSSL(self.config.port, MMCSite(r), interface=self.config.host, contextFactory=sslContext)
        else:
            logger.warning("SSL is disabled by configuration.")
            reactor.listenTCP(self.config.port, server.Site(r), interface=self.config.host)

        # Add event handler before shutdown
        reactor.addSystemEventTrigger("before", "shutdown", self.cleanUp)
        logger.info("Listening to XML-RPC requests on %s:%s" % (self.config.host, self.config.port))
예제 #2
0
def getProxy(schedulerConfig):
    """
    Return a suitable Proxy object to communicate with the scheduler
    """
    (url, credentials) = makeURL(schedulerConfig)

    if url.startswith("http://"):
        ret = twisted.web.xmlrpc.Proxy(url)
    else:
        if schedulerConfig['verifypeer']:
            # We have to build the SSL context to include launcher certificates
            ctx = makeSSLContext(schedulerConfig['verifypeer'], schedulerConfig['cacert'], schedulerConfig['localcert'], False)
            ret = async.Proxy(url)
            ret.setSSLClientContext(ctx)
        else:
            ret = twisted.web.xmlrpc.Proxy(url)
    return ret
예제 #3
0
def getProxy(schedulerConfig):
    """
    Return a suitable Proxy object to communicate with the scheduler
    """
    (url, credentials) = makeURL(schedulerConfig)

    if url.startswith("http://"):
        ret = twisted.web.xmlrpc.Proxy(url)
    else:
        if schedulerConfig['verifypeer']:
            # We have to build the SSL context to include launcher certificates
            ctx = makeSSLContext(schedulerConfig['verifypeer'],
                                 schedulerConfig['cacert'],
                                 schedulerConfig['localcert'], False)
            ret = async .Proxy(url)
            ret.setSSLClientContext(ctx)
        else:
            ret = twisted.web.xmlrpc.Proxy(url)
    return ret
예제 #4
0
    def startService(self, mod):
        # Starting XMLRPC server
        r = MmcServer(mod, self.config)
        if self.config.enablessl:
            sslContext = makeSSLContext(self.config.verifypeer,
                                        self.config.cacert,
                                        self.config.localcert)
            reactor.listenSSL(self.config.port,
                              MMCSite(r),
                              interface=self.config.host,
                              contextFactory=sslContext)
        else:
            logger.warning("SSL is disabled by configuration.")
            reactor.listenTCP(self.config.port,
                              server.Site(r),
                              interface=self.config.host)

        # Add event handler before shutdown
        reactor.addSystemEventTrigger('before', 'shutdown', self.cleanUp)
        logger.info("Listening to XML-RPC requests on %s:%s" %
                    (self.config.host, self.config.port))