Beispiel #1
0
def initialize(config_path=None):
    """Loads the config file, loads the app cache, and loads the app APIs into memory"""
    Config.load_config(config_path)
    setup_logger()
    from walkoff.appgateway import cache_apps
    cache_apps(Config.APPS_PATH)
    load_app_apis()
Beispiel #2
0
def initialize():
    """Loads the config file, loads the app cache, and loads the app APIs into memory
    """
    load_config()
    from walkoff.appgateway import cache_apps
    cache_apps(walkoff.config.paths.apps_path)
    load_app_apis()
Beispiel #3
0
def convert_playbooks(mode, tgt_version):
    cache_apps(join('.', 'apps'))
    load_app_apis()
    for subd, d, files in os.walk(join('workflows')):
        for f in files:
            if f.endswith('.playbook'):
                path = os.path.join(subd, f)
                convert_playbook(path, mode, tgt_version)
Beispiel #4
0
 def setUpClass(cls):
     from walkoff.appgateway import cache_apps
     cache_apps(path=config.test_apps_path)
     walkoff.config.config.load_app_apis(apps_path=config.test_apps_path)
     walkoff.config.config.num_processes = 2
     MultiprocessedExecutor.initialize_threading = mock_initialize_threading
     MultiprocessedExecutor.wait_and_reset = mock_wait_and_reset
     MultiprocessedExecutor.shutdown_pool = mock_shutdown_pool
     walkoff.controller.controller.initialize_threading()
Beispiel #5
0
def initialize(config_path=None, load=True):
    """Loads the config file, loads the app cache, and loads the app APIs into memory"""
    if load:
        Config.load_config(config_path)
        Config.load_env_vars()
        Config.read_and_set_zmq_keys()
    setup_logger()
    from walkoff.appgateway import cache_apps
    cache_apps(Config.APPS_PATH)
    load_app_apis()
Beispiel #6
0
def convert_playbooks(mode, tgt_version):
    initialize_databases()
    cache_apps(join('.', 'apps'))
    load_app_apis()

    for subd, d, files in os.walk(walkoff.config.Config.WORKFLOWS_PATH):
        for f in files:
            if f.endswith('.playbook'):
                path = os.path.join(subd, f)
                convert_playbook(path, mode, tgt_version)
Beispiel #7
0
def initialize(config_path=None, load=True):
    """Loads the config file, loads the app cache, and loads the app APIs into memory"""
    if load:
        Config.load_config(config_path)
        Config.load_env_vars()
        Config.read_and_set_zmq_keys()
    setup_logger()
    from walkoff.appgateway import cache_apps
    cache_apps(Config.APPS_PATH)
    load_app_apis()
Beispiel #8
0
def convert_playbooks(current_version, target_version, workflows_path,
                      apps_path):
    #initialize_databases()
    cache_apps(apps_path)
    load_app_apis()

    for subd, d, files in os.walk(workflows_path):
        for f in files:
            if f.endswith('.playbook'):
                path = os.path.join(subd, f)
                convert_playbook(path, version)
Beispiel #9
0
        logger.fatal('Could not connect to Redis cache.', exc_info=True)
        raise
    return redis_cache


def make_execution_db():
    execution_db_path = os.environ.get('EXECUTION_DB_PATH')
    execution_db_type = os.environ.get('EXECUTION_DB_TYPE', 'postgresql')
    logging.info('Connecting to Execution DB with type {} at {}'.format(execution_db_type, execution_db_path))
    execution_db = ExecutionDatabase(execution_db_type, execution_db_path)
    return execution_db


app_path = os.environ.get('APP_PATH', './app')

cache_apps(app_path)
walkoff.config.load_app_apis(app_path)
execution_post_schema = parse_openapi(os.environ.get('OPENAPI_PATH', 'api.yaml'))
redis_cache = make_redis()
execution_db = make_execution_db()


class ActionExecution(object):

    def __init__(self, strategy, kafka_sender, accumulator):
        self.strategy = strategy
        self.accumulator = accumulator
        self.kafka_sender = kafka_sender

    def on_post(self, req, resp, workflow_exec_id, action_exec_id):
Beispiel #10
0
def initialize():
    load_config()
    from walkoff.appgateway import cache_apps
    cache_apps(walkoff.config.paths.apps_path)
    load_app_apis()