Exemplo n.º 1
0
def main(args=None):
    config.backend_conf(
            defaults={'NAME':'beah_forwarder_backend'},
            overrides=config.backend_opts(args=args))
    log_handler()
    start_forwarder_backend()
    reactor.run()
Exemplo n.º 2
0
def main():
    config.backend_conf(defaults={'NAME': 'beah_cmd_backend'},
                        overrides=config.backend_opts())
    log_handler()
    print cmd_backend_intro
    cmd_backend()
    reactor.run()
Exemplo n.º 3
0
def main():
    config.backend_conf(
            defaults={'NAME':'beah_cmd_backend'},
            overrides=config.backend_opts())
    log_handler()
    print cmd_backend_intro
    cmd_backend()
    reactor.run()
Exemplo n.º 4
0
def out_backend():
    """
    Simple backend for pretty-printing events received from Controller.
    """
    config.backend_conf(defaults={'NAME': 'beah_out_backend'},
                        overrides=config.backend_opts())
    log_handler()
    start_backend(PprintBackend())
Exemplo n.º 5
0
def out_backend():
    """
    Simple backend for pretty-printing events received from Controller.
    """
    config.backend_conf(
            defaults={'NAME':'beah_out_backend'},
            overrides=config.backend_opts())
    log_handler()
    start_backend(PprintBackend())
Exemplo n.º 6
0
def configure():
    '''\
    Returns a watchdog backend configuration.

    This uses command line options, environment and config.file as sources in
    that order.

    '''
    config.backend_conf(env_var='BEAH_WATCHDOG_CONF', filename='beah_watchdog.conf',
            defaults=defaults(), overrides=config.backend_opts(option_adder=watchdog_opts))
    return config.get_conf('beah-backend')
Exemplo n.º 7
0
def _try_backend_conf():
    config.backend_conf('BEAH_BEAKER_CONF', 'beah_beaker.conf',
            {'MY_OWN':'1', 'TEST.MY_OWN':'2', 'TEST2.DEF':'3'},
            {'DEFAULT.MY_OWN':'4', 'TEST.MY_OWN':'3'})
    #config._get_config('beah-backend').print_()
    #config._get_config('beah-backend').print_(defaults_display='exclude')
    #config._get_config('beah-backend').print_(defaults_display='show')
    #config._get_config('beah-backend').print_(raw=True)
    #config._get_config('beah-backend').print_(raw=True, defaults_display='exclude')
    #config._get_config('beah-backend').print_(raw=True, defaults_display='show')
    #dump_config(config._get_config('beah-backend'))
    config._Config._remove('beah-backend')
Exemplo n.º 8
0
def configure():
    '''\
    Returns a watchdog backend configuration.

    This uses command line options, environment and config.file as sources in
    that order.

    '''
    config.backend_conf(
        env_var='BEAH_WATCHDOG_CONF',
        filename='beah_watchdog.conf',
        defaults=defaults(),
        overrides=config.backend_opts(option_adder=watchdog_opts))
    return config.get_conf('beah-backend')
Exemplo n.º 9
0
def _try_backend_conf():
    config.backend_conf('BEAH_BEAKER_CONF', 'beah_beaker.conf', {
        'MY_OWN': '1',
        'TEST.MY_OWN': '2',
        'TEST2.DEF': '3'
    }, {
        'DEFAULT.MY_OWN': '4',
        'TEST.MY_OWN': '3'
    })
    #config._get_config('beah-backend').print_()
    #config._get_config('beah-backend').print_(defaults_display='exclude')
    #config._get_config('beah-backend').print_(defaults_display='show')
    #config._get_config('beah-backend').print_(raw=True)
    #config._get_config('beah-backend').print_(raw=True, defaults_display='exclude')
    #config._get_config('beah-backend').print_(raw=True, defaults_display='show')
    #dump_config(config._get_config('beah-backend'))
    config._Config._remove('beah-backend')
Exemplo n.º 10
0
def beah_run(coro, **kwargs):
    """
    This is a Backend to issue script to Controller.

    Type help on the prompt for help o commands.

    You might not see any output here - run out_backend.

    Known issues:

    * Type <Ctrl-C> to finish.

    I do not want to stop reactor directly, but would like if it stopped when
    there are no more protocols.
    """
    config.backend_conf(
            defaults={'NAME':'beahcmd_backend'},
            overrides=config.backend_opts())
    log_handler()
    backend = BeahRunner(coro)
    # Start a default TCP client:
    start_backend(backend, **kwargs)
Exemplo n.º 11
0
Arquivo: cli.py Projeto: sssst315/beah
def main_beah(args=None):
    """\
This is a Backend to issue commands to Controller.

Type help on the prompt for help o commands.

You might not see any output here - run out_backend.

Known issues:

 * Type <Ctrl-C> to finish.

   I do not want to stop reactor directly, but would like if it stopped if
   there are no more protocols.
"""
    overrides, rest = config.backend_opts_ex(args=args)
    config.backend_conf(defaults={'NAME': 'beah_cli_backend'},
                        overrides=overrides)
    log_handler()
    cmdline = ' '.join(["%r" % r for r in rest])
    backend = CmdLineBackend(cmdline)
    # Start a default TCP client:
    start_backend(backend)
Exemplo n.º 12
0
def main_beah(args=None):
    """\
This is a Backend to issue commands to Controller.

Type help on the prompt for help o commands.

You might not see any output here - run out_backend.

Known issues:

 * Type <Ctrl-C> to finish.

   I do not want to stop reactor directly, but would like if it stopped if
   there are no more protocols.
"""
    overrides, rest = config.backend_opts_ex(args=args)
    config.backend_conf(
            defaults={'NAME':'beah_cli_backend'},
            overrides=overrides)
    log_handler()
    cmdline = ' '.join(["%r" % r for r in rest])
    backend = CmdLineBackend(cmdline)
    # Start a default TCP client:
    start_backend(backend)
Exemplo n.º 13
0
        def linfo(self, fmt, *args, **kwargs):
            l = [self.__class__.__name__]
            l.extend(args)
            logging.getLogger('backend').info('%s: '+fmt, *l, **kwargs)

        def connectionMade(self):
            self.linfo("I am connected!")
            ControllerAdaptor_Backend_JSON.connectionMade(self)
            self.proc_cmd(self.backend, command.PING("Hello everybody!"))

        def connectionLost(self, reason):
            self.linfo("I was lost!")

        def lineReceived(self, data):
            self.linfo('Data received.  Data: %r', data)
            ControllerAdaptor_Backend_JSON.lineReceived(self, data)

    class DemoPprintBackend(PprintBackend):
        def set_controller(self, controller=None):
            PprintBackend.set_controller(self, controller)
            if controller:
                self.controller.proc_cmd(self, command.ping("Are you there?"))

    config.backend_conf(
            defaults={'NAME':'beah_demo_backend'},
            overrides=config.backend_opts())
    log_handler()
    start_backend(DemoPprintBackend(), adaptor=DemoOutAdaptor)
    reactor.run()

Exemplo n.º 14
0
def main(args=None):
    config.backend_conf(defaults={'NAME': 'beah_forwarder_backend'},
                        overrides=config.backend_opts(args=args))
    log_handler()
    start_forwarder_backend()
    reactor.run()
Exemplo n.º 15
0
def _try_conf2():
    overrides = config.backend_opts(args=[])
    config.backend_conf(
            defaults={'NAME':'beah_demo_backend'},
            overrides=overrides)
    config._Config._remove('beah-backend')
Exemplo n.º 16
0
def _try_conf2():
    overrides = config.backend_opts(args=[])
    config.backend_conf(defaults={'NAME': 'beah_demo_backend'},
                        overrides=overrides)
    config._Config._remove('beah-backend')