Ejemplo n.º 1
0
    def __init__(self, args):
        self._components = []
        self.uistates = {}
        self.uistates_by_name = {}
        self._translator = Translator()
        log.init()

        parser = optparse.OptionParser()
        parser.add_option('-d', '--debug',
            action="store", type="string", dest="debug",
            help="set debug levels")
        parser.add_option('-u', '--usage',
            action="store_true", dest="usage",
            help="show a usage message")
        parser.add_option('-m', '--manager',
            action="store", type="string", dest="manager",
            help="the manager to connect to, e.g. localhost:7531")
        parser.add_option('', '--no-ssl',
            action="store_true", dest="no_ssl",
            help="disable encryption when connecting to the manager")
        parser.add_option('-s', '--stomp-port', action="store", type="string",
            dest="stomp")
        options, args = parser.parse_args(args)

        if options.debug:
            log.setFluDebug(options.debug)

        if options.usage:
            self.usage(args)

        if not options.manager or not options.stomp:
            self.usage(args)

        print "need to connect to stomp port %s" % (options.stomp,)
        self.options = options
        connection = connections.parsePBConnectionInfo(options.manager,
            use_ssl=not options.no_ssl)
        self.model = model = AdminModel()
        self.stomp_client = StompClient()
        reactor.connectTCP("localhost", int(self.options.stomp), self.stomp_client)
        self.model.connect('connected', self._connected)
        self.model.connect('disconnected', self._disconnected)
        self.model.connect('update', self._update)

        d = model.connectToManager(connection)

        def failed(failure):
            if failure.check(errors.ConnectionRefusedError):
                print "Manager refused connection. Check your user and password."
            elif failure.check(errors.ConnectionFailedError):
                message = "".join(failure.value.args)
                print "Connection to manager failed: %s" % message
            else:
                print ("Exception while connecting to manager: %s"
                       % log.getFailureMessage(failure))
            return failure

        d.addErrback(failed)
        d.addErrback(lambda x: reactor.stop())
Ejemplo n.º 2
0
    def __init__(self, args):
        self._components = []
        self.uistates = {}
        self.uistates_by_name = {}
        self._translator = Translator()
        log.init()

        parser = optparse.OptionParser()
        parser.add_option('-d', '--debug',
                          action="store", type="string", dest="debug",
                          help="set debug levels")
        parser.add_option('-u', '--usage',
                          action="store_true", dest="usage",
                          help="show a usage message")
        parser.add_option('-m', '--manager',
                          action="store", type="string", dest="manager",
                          help="the manager to connect to, e.g. localhost:7531")
        parser.add_option('', '--no-ssl',
                          action="store_true", dest="no_ssl",
                          help="disable encryption when connecting to the manager")
        parser.add_option('-s', '--stomp-port', action="store", type="string",
                          dest="stomp")
        options, args = parser.parse_args(args)

        if options.debug:
            log.setFluDebug(options.debug)

        if options.usage:
            self.usage(args)

        if not options.manager or not options.stomp:
            self.usage(args)
        
        print "need to connect to stomp port %s" % (options.stomp,)
        self.options = options
        connection = connections.parsePBConnectionInfo(options.manager,
                                                       not options.no_ssl)
        self.model = model = AdminModel()
        self.stomp_client = StompClient()
        reactor.connectTCP("localhost", int(self.options.stomp), self.stomp_client)
        self.model.connect('connected', self._connected)
        self.model.connect('disconnected', self._disconnected)
        self.model.connect('update', self._update)

        d = model.connectToManager(connection)

        def failed(failure):
            if failure.check(errors.ConnectionRefusedError):
                print "Manager refused connection. Check your user and password."
            elif failure.check(errors.ConnectionFailedError):
                message = "".join(failure.value.args)
                print "Connection to manager failed: %s" % message
            else:
                print ("Exception while connecting to manager: %s"
                       % log.getFailureMessage(failure))
            return failure

        d.addErrback(failed)
        d.addErrback(lambda x: reactor.stop())
Ejemplo n.º 3
0
    def __init__(self):
        log.init()

        self.medium = admin.AdminModel()

        i = connection.PBConnectionInfo(
            "127.0.0.1", 7531, True, pb.Authenticator(username='******', password='******'))
        d = self.medium.connectToManager(i)
        d.addCallback(self.connected)
        d.addErrback(twistedlog.err)
Ejemplo n.º 4
0
    def __init__(self):
        log.init()

        self.medium = admin.AdminModel()

        i = connection.PBConnectionInfo(
            "127.0.0.1", 7531, True,
            pb.Authenticator(username='******', password='******'))
        d = self.medium.connectToManager(i)
        d.addCallback(self.connected)
        d.addErrback(twistedlog.err)
Ejemplo n.º 5
0
def setup():
    """
    Set up the logging system.
    """
    from flumotion.common import log
    log.init()
Ejemplo n.º 6
0
def setup():
    """
    Set up the logging system.
    """
    from flumotion.common import log
    log.init()