def main(): if Config.setup_logger(): _setup_logger() else: logging.basicConfig(level=logging.INFO) args = _args() Config.set_access_key(args.access_key) Config.set_secret_key(args.secret_key) Config.set_api_url(args.url) process_manager.init() plugins.load() log.info('API URL %s', Config.api_url()) client = EventClient(Config.api_url(), auth=Config.api_auth(), workers=args.workers, agent_id=args.agent_id) events = _gather_events() log.info("Subscribing to %s", events) for startup in get_type_list(LIFECYCLE): startup.on_startup() client.run(events) sys.exit(0)
import os import sys import tests import shutil import pytest from cattle import CONFIG_OVERRIDE CONFIG_OVERRIDE['DOCKER_REQUIRED'] = 'false' # NOQA from os.path import dirname _file = os.path.abspath(__file__) # NOQA sys.path.insert(0, dirname(dirname(_file))) # NOQA from cattle import plugins plugins.load() TEST_DIR = os.path.join(dirname(tests.__file__)) SCRATCH_DIR = os.path.join(TEST_DIR, 'scratch') if os.path.exists(SCRATCH_DIR): shutil.rmtree(SCRATCH_DIR) os.makedirs(SCRATCH_DIR) @pytest.fixture(scope='session', autouse=True) def scratch_dir(request): request.addfinalizer( lambda: shutil.rmtree(SCRATCH_DIR, ignore_errors=True))
import sys import tests import shutil import pytest from cattle import CONFIG_OVERRIDE CONFIG_OVERRIDE["DOCKER_REQUIRED"] = "false" # NOQA from os.path import dirname _file = os.path.abspath(__file__) # NOQA sys.path.insert(0, dirname(dirname(_file))) # NOQA from cattle import plugins plugins.load() TEST_DIR = os.path.join(dirname(tests.__file__)) SCRATCH_DIR = os.path.join(TEST_DIR, "scratch") if os.path.exists(SCRATCH_DIR): shutil.rmtree(SCRATCH_DIR) os.makedirs(SCRATCH_DIR) @pytest.fixture(scope="session", autouse=True) def scratch_dir(request): request.addfinalizer(lambda: shutil.rmtree(SCRATCH_DIR, ignore_errors=True))