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()
def main(): config.backend_conf(defaults={'NAME': 'beah_cmd_backend'}, overrides=config.backend_opts()) log_handler() print cmd_backend_intro cmd_backend() reactor.run()
def main(): config.backend_conf( defaults={'NAME':'beah_cmd_backend'}, overrides=config.backend_opts()) log_handler() print cmd_backend_intro cmd_backend() reactor.run()
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())
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())
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')
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')
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')
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')
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)
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)
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)
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()
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()
def _try_conf2(): overrides = config.backend_opts(args=[]) config.backend_conf( defaults={'NAME':'beah_demo_backend'}, overrides=overrides) config._Config._remove('beah-backend')
def _try_conf2(): overrides = config.backend_opts(args=[]) config.backend_conf(defaults={'NAME': 'beah_demo_backend'}, overrides=overrides) config._Config._remove('beah-backend')