Ejemplo n.º 1
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    registered_count = 0

    try:
        LOG.info('=========================================================')
        LOG.info('############## Registering actions ######################')
        LOG.info('=========================================================')
        # Importing here to reduce scope of dependency. This way even if st2action
        # is not installed bootstrap continues.
        import st2actions.bootstrap.runnersregistrar as runners_registrar
        runners_registrar.register_runner_types(experimental=cfg.CONF.experimental)
    except Exception as e:
        LOG.warning('Failed to register runner types: %s', e, exc_info=True)
        LOG.warning('Not registering stock runners .')
    else:
        try:
            # Importing here to reduce scope of dependency. This way even if st2action
            # is not installed bootstrap continues.
            import st2actions.bootstrap.actionsregistrar as actions_registrar
            registered_count = actions_registrar.register_actions(pack_dir=cfg.CONF.register.pack)
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)

    LOG.info('Registered %s actions.' % (registered_count))
Ejemplo n.º 2
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    try:
        LOG.info('=========================================================')
        LOG.info('############## Registering actions ######################')
        LOG.info('=========================================================')
        # Importing here to reduce scope of dependency. This way even if st2action
        # is not installed bootstrap continues.
        import st2actions.bootstrap.runnersregistrar as runners_registrar
        runners_registrar.register_runner_types()
    except Exception as e:
        LOG.warning('Failed to register runner types: %s', e, exc_info=True)
        LOG.warning('Not registering stock runners .')
    else:
        try:
            # Importing here to reduce scope of dependency. This way even if st2action
            # is not installed bootstrap continues.
            import st2actions.bootstrap.actionsregistrar as actions_registrar
            registered_count = actions_registrar.register_actions(
                pack_dir=cfg.CONF.register.pack)
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)

    LOG.info('Registered %s actions.' % (registered_count))
Ejemplo n.º 3
0
    def setUpClass(cls):
        super(TestMistralRunner, cls).setUpClass()
        runners_registrar.register_runner_types()

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
Ejemplo n.º 4
0
    def setUpClass(cls):
        super(TestMistralRunner, cls).setUpClass()
        runners_registrar.register_runner_types()

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
Ejemplo n.º 5
0
Archivo: base.py Proyecto: joshgre/st2
    def setUpClass(cls):
        super(FunctionalTest, cls).setUpClass()

        tests_config.parse_args()
        cfg.CONF.set_default('enable', False, group='auth')

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {
                    '__force_dict__': True
                }
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = load_test_app(config=cfg_dict)
Ejemplo n.º 6
0
 def setUpClass(cls):
     super(TestActionExecutionHistoryWorker, cls).setUpClass()
     runners_registrar.register_runner_types()
     action_local = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))
     action_chain = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['chain']))
     action_chain.entry_point = fixture.PATH + '/chain.yaml'
     Action.add_or_update(ActionAPI.to_model(action_chain))
Ejemplo n.º 7
0
 def setUpClass(cls):
     super(TestMistralRunner, cls).setUpClass()
     runners_registrar.register_runner_types()
     metadata = fixture.ARTIFACTS['metadata']
     action_local = ActionAPI(**copy.deepcopy(metadata['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))
     action_wkflow = ActionAPI(**copy.deepcopy(metadata['actions']['workflow-v2']))
     Action.add_or_update(ActionAPI.to_model(action_wkflow))
Ejemplo n.º 8
0
 def setUpClass(cls):
     super(TestMistralRunner, cls).setUpClass()
     runners_registrar.register_runner_types()
     metadata = fixture.ARTIFACTS['metadata']
     action_local = ActionAPI(**copy.deepcopy(metadata['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))
     action_wkflow = ActionAPI(
         **copy.deepcopy(metadata['actions']['workflow-v2']))
     Action.add_or_update(ActionAPI.to_model(action_wkflow))
Ejemplo n.º 9
0
    def setUpClass(cls):
        super(DSLTransformTestCase, cls).setUpClass()
        runners_registrar.register_runner_types()

        for _, fixture in six.iteritems(FIXTURES['runners']):
            instance = RunnerTypeAPI(**fixture)
            RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
Ejemplo n.º 10
0
    def setUpClass(cls):
        super(DSLTransformTestCase, cls).setUpClass()
        runners_registrar.register_runner_types()

        action_local = ActionAPI(**copy.deepcopy(FIXTURES['actions']['local.yaml']))
        Action.add_or_update(ActionAPI.to_model(action_local))

        for action_name in ['action1', 'action2', 'action3']:
            metadata = copy.deepcopy(FIXTURES['actions']['local.yaml'])
            metadata['name'] = action_name
            metadata['pack'] = 'demo'
            action = ActionAPI(**metadata)
            Action.add_or_update(ActionAPI.to_model(action))
Ejemplo n.º 11
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    try:
        runners_registrar.register_runner_types()
    except Exception as e:
        LOG.warning('Failed to register action types: %s', e, exc_info=True)
        LOG.warning('Not registering stock actions.')
    else:
        try:
            actions_registrar.register_actions()
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)
Ejemplo n.º 12
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    try:
        runners_registrar.register_runner_types()
    except Exception as e:
        LOG.warning('Failed to register action types: %s', e, exc_info=True)
        LOG.warning('Not registering stock actions.')
    else:
        try:
            actions_registrar.register_actions()
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)
Ejemplo n.º 13
0
    def setUpClass(cls):
        super(AuthMiddlewareTest, cls).setUpClass()
        tests_config.parse_args()

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {'__force_dict__': True}
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = TestApp(auth.AuthMiddleware(load_app(cfg_dict)))
Ejemplo n.º 14
0
 def setUpClass(cls):
     super(DSLTransformTestCase, cls).setUpClass()
     runners_registrar.register_runner_types()
     action_local = ActionAPI(
         **copy.deepcopy(FIXTURES['actions']['local.json']))
     Action.add_or_update(ActionAPI.to_model(action_local))