def main(args, config): start_logging(args) signal.signal(signal.SIGQUIT, system_exit_handler) signal.signal(signal.SIGABRT, system_exit_handler) signal.signal(signal.SIGTERM, system_exit_handler) signal.signal(signal.SIGHUP, signal.SIG_IGN) signal.signal(signal.SIGUSR1, shutdown_request_handler) logger = logging.getLogger('debile') if not os.path.isfile(config['keyrings']['pgp']): logger.info("Can not find pgp keyring `{file}'".format(file=config['keyrings']['pgp'])) auth_method = get_auth_method(args, config) if auth_method == 'ssl': if not os.path.isfile(config['xmlrpc']['keyfile']): logger.error("Can not find ssl keyfile `{file}'".format(file=config['xmlrpc']['keyfile'])) if not os.path.isfile(config['xmlrpc']['certfile']): logger.error("Can not find ssl certfile `{file}'".format(file=config['xmlrpc']['certfile'])) if not os.path.isfile(config['keyrings']['ssl']): logger.error("Can not find ssl keyring `{file}'".format(file=config['keyrings']['ssl'])) serve(config['xmlrpc']['addr'], config['xmlrpc']['port'], auth_method, config['xmlrpc'].get('keyfile'), config['xmlrpc'].get('certfile'), config['keyrings'].get('ssl'), config["keyrings"].get('pgp'))
def test_get_auth_method_with_cli_option_and_without_yaml_config(self): args = parse_args(['--auth', 'simple']) config = {} auth_method = get_auth_method(args, config) self.assertEqual(auth_method, 'simple')
def main(args, config): start_logging(args) signal.signal(signal.SIGQUIT, system_exit_handler) signal.signal(signal.SIGABRT, system_exit_handler) signal.signal(signal.SIGTERM, system_exit_handler) signal.signal(signal.SIGHUP, signal.SIG_IGN) signal.signal(signal.SIGUSR1, shutdown_request_handler) logger = logging.getLogger('debile') if not os.path.isfile(config['keyrings']['pgp']): logger.info("Can not find pgp keyring `{file}'".format( file=config['keyrings']['pgp'])) auth_method = get_auth_method(args, config) if auth_method == 'ssl': if not os.path.isfile(config['xmlrpc']['keyfile']): logger.error("Can not find ssl keyfile `{file}'".format( file=config['xmlrpc']['keyfile'])) if not os.path.isfile(config['xmlrpc']['certfile']): logger.error("Can not find ssl certfile `{file}'".format( file=config['xmlrpc']['certfile'])) if not os.path.isfile(config['keyrings']['ssl']): logger.error("Can not find ssl keyring `{file}'".format( file=config['keyrings']['ssl'])) serve(config['xmlrpc']['addr'], config['xmlrpc']['port'], auth_method, config['xmlrpc'].get('keyfile'), config['xmlrpc'].get('certfile'), config['keyrings'].get('ssl'), config["keyrings"].get('pgp'))
def test_get_auth_method_without_cli_option_and_without_yaml_config(self): # Default value in args is 'ssl' args = parse_args(['--auth', 'ssl']) config = {} auth_method = get_auth_method(args, config) self.assertEqual(auth_method, 'ssl')
def test_get_auth_method_without_cli_option_but_with_yaml_config(self): # Default value in args is 'ssl' args = parse_args(['--auth', 'ssl']) config = {'xmlrpc': {'auth_method': 'simple'}} auth_method = get_auth_method(args, config) self.assertEqual(auth_method, 'simple')
def daemon(): args = parse_args(sys.argv[1:]) config = get_config("slave.yaml", path=args.config) auth_method = get_auth_method(args, config) proxy = get_proxy(config, auth_method) from debile.slave.daemon import main main(args, config, proxy)