Exemple #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()
Exemple #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()
Exemple #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()
Exemple #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())
Exemple #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())
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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)
Exemple #11
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)
Exemple #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)
Exemple #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()

Exemple #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()
Exemple #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')
Exemple #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')