コード例 #1
0
    def setUpClass(cls):
        super(TestStreamController, cls).setUpClass()

        instance = RunnerTypeAPI(**RUNNER_TYPE_1)
        RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        instance = ActionAPI(**ACTION_1)
        Action.add_or_update(ActionAPI.to_model(instance))
コード例 #2
0
ファイル: test_rules.py プロジェクト: ojacques/st2
 def setUp(self):
     RUNNER_TYPE.id = None
     RunnerType.add_or_update(RUNNER_TYPE)
     ACTION.id = None
     ACTION.runner_type = {'name': RUNNER_TYPE.name}
     Action.add_or_update(ACTION)
     TRIGGER.id = None
     Trigger.add_or_update(TRIGGER)
コード例 #3
0
ファイル: test_stream.py プロジェクト: lyandut/st2
    def setUpClass(cls):
        super(TestStreamController, cls).setUpClass()

        instance = RunnerTypeAPI(**RUNNER_TYPE_1)
        RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        instance = ActionAPI(**ACTION_1)
        Action.add_or_update(ActionAPI.to_model(instance))
コード例 #4
0
    def setUpClass(cls):
        super(TestActionAPIValidator, cls).setUpClass()

        runner_api_dict = fixture.ARTIFACTS['runners']['run-local']
        runner_api = RunnerTypeAPI(**runner_api_dict)
        runner_model = RunnerTypeAPI.to_model(runner_api)

        RunnerType.add_or_update(runner_model)
コード例 #5
0
ファイル: test_runner_container.py プロジェクト: ojacques/st2
 def setup_runner(cls):
     test_runner = {
         'name': 'test-runner',
         'description': 'A test runner.',
         'enabled': True,
         'runner_parameters': {
             'runnerstr': {
                 'description': 'Foo str param.',
                 'type': 'string',
                 'default': 'defaultfoo'
             },
             'runnerint': {
                 'description': 'Foo int param.',
                 'type': 'number'
             },
             'runnerdummy': {
                 'description': 'Dummy param.',
                 'type': 'string',
                 'default': 'runnerdummy'
             },
             'runnerimmutable': {
                 'description': 'Immutable param.',
                 'type': 'string',
                 'default': 'runnerimmutable',
                 'immutable': True
             }
         },
         'runner_module': 'tests.test_runner'
     }
     runnertype_api = RunnerTypeAPI(**test_runner)
     RunnerContainerTest.runnertype_db = RunnerType.add_or_update(
         RunnerTypeAPI.to_model(runnertype_api))
     test_failingrunner = {
         'name': 'test-failingrunner',
         'description': 'A failing test runner.',
         'enabled': True,
         'runner_parameters': {
             'raise': {
                 'description': 'Foo str param.',
                 'type': 'boolean',
                 'default': True,
                 'immutable': True
             }
         },
         'runner_module': 'tests.test_runner'
     }
     runnertype_api = RunnerTypeAPI(**test_failingrunner)
     RunnerContainerTest.runnertype_db = RunnerType.add_or_update(
         RunnerTypeAPI.to_model(runnertype_api))
コード例 #6
0
 def setup_runner(cls):
     test_runner = {
         'name': 'test-runner',
         'description': 'A test runner.',
         'enabled': True,
         'runner_parameters': {
             'runnerstr': {
                 'description': 'Foo str param.',
                 'type': 'string',
                 'default': 'defaultfoo'
             },
             'runnerint': {
                 'description': 'Foo int param.',
                 'type': 'number'
             },
             'runnerdummy': {
                 'description': 'Dummy param.',
                 'type': 'string',
                 'default': 'runnerdummy'
             }
         },
         'runner_module': 'tests.test_runner'
     }
     runnertype_api = RunnerTypeAPI(**test_runner)
     ActionDBUtilsTestCase.runnertype_db = RunnerType.add_or_update(
         RunnerTypeAPI.to_model(runnertype_api))
コード例 #7
0
ファイル: runnersregistrar.py プロジェクト: ravidsinghbiz/st2
def register_runner_types():
    LOG.debug('Start : register default RunnerTypes.')

    for runnertype in RUNNER_TYPES:
        try:
            runnertype_db = get_runnertype_by_name(runnertype['name'])
            update = True
        except StackStormDBObjectNotFoundError:
            runnertype_db = None
            update = False

        runnertype_api = RunnerTypeAPI(**runnertype)
        runnertype_api.validate()
        runner_type_model = RunnerTypeAPI.to_model(runnertype_api)

        if runnertype_db:
            runner_type_model.id = runnertype_db.id

        try:
            runnertype_db = RunnerType.add_or_update(runner_type_model)

            extra = {'runnertype_db': runnertype_db}
            if update:
                LOG.audit('RunnerType updated. RunnerType %s',
                          runnertype_db,
                          extra=extra)
            else:
                LOG.audit('RunnerType created. RunnerType %s',
                          runnertype_db,
                          extra=extra)
        except Exception:
            LOG.exception('Unable to register runner type %s.',
                          runnertype['name'])

    LOG.debug('End : register default RunnerTypes.')
コード例 #8
0
 def setup_runner(cls):
     test_runner = {
         'name': 'test-runner',
         'description': 'A test runner.',
         'enabled': True,
         'runner_parameters': {
             'runnerstr': {
                 'description': 'Foo str param.',
                 'type': 'string',
                 'default': 'defaultfoo'
             },
             'runnerint': {
                 'description': 'Foo int param.',
                 'type': 'number'
             },
             'runnerdummy': {
                 'description': 'Dummy param.',
                 'type': 'string',
                 'default': 'runnerdummy'
             }
         },
         'runner_module': 'tests.test_runner'
     }
     runnertype_api = RunnerTypeAPI(**test_runner)
     ActionDBUtilsTestCase.runnertype_db = RunnerType.add_or_update(
         RunnerTypeAPI.to_model(runnertype_api))
コード例 #9
0
def register_runner_types():
    LOG.debug('Start : register default RunnerTypes.')

    for runnertype in RUNNER_TYPES:
        try:
            runnertype_db = get_runnertype_by_name(runnertype['name'])
            update = True
        except StackStormDBObjectNotFoundError:
            runnertype_db = None
            update = False

        runnertype_api = RunnerTypeAPI(**runnertype)
        runnertype_api.validate()
        runner_type_model = RunnerTypeAPI.to_model(runnertype_api)

        if runnertype_db:
            runner_type_model.id = runnertype_db.id

        try:
            runnertype_db = RunnerType.add_or_update(runner_type_model)

            extra = {'runnertype_db': runnertype_db}
            if update:
                LOG.audit('RunnerType updated. RunnerType %s', runnertype_db, extra=extra)
            else:
                LOG.audit('RunnerType created. RunnerType %s', runnertype_db, extra=extra)
        except Exception:
            LOG.exception('Unable to register runner type %s.', runnertype['name'])

    LOG.debug('End : register default RunnerTypes.')
コード例 #10
0
 def setUpClass(cls):
     super(TestActionExecutionService, cls).setUpClass()
     cls.runner = RunnerTypeAPI(**RUNNER)
     cls.runnerdb = RunnerType.add_or_update(
         RunnerTypeAPI.to_model(cls.runner))
     cls.action = ActionAPI(**ACTION)
     cls.actiondb = Action.add_or_update(ActionAPI.to_model(cls.action))
コード例 #11
0
def register_runner_types(experimental=False):
    """
    :param experimental: True to also register experimental runners.
    :type experimental: ``bool``
    """
    LOG.debug('Start : register default RunnerTypes.')

    for runner_type in RUNNER_TYPES:
        runner_type = copy.deepcopy(runner_type)

        # For backward compatibility reasons, we also register runners under the old names
        runner_names = [runner_type['name']] + runner_type.get('aliases', [])
        for runner_name in runner_names:
            runner_type['name'] = runner_name
            runner_experimental = runner_type.get('experimental', False)

            if runner_experimental and not experimental:
                LOG.debug('Skipping experimental runner "%s"' % (runner_name))
                continue

            # Remove additional, non db-model attributes
            non_db_attributes = ['experimental', 'aliases']
            for attribute in non_db_attributes:
                if attribute in runner_type:
                    del runner_type[attribute]

            try:
                runner_type_db = get_runnertype_by_name(runner_name)
                update = True
            except StackStormDBObjectNotFoundError:
                runner_type_db = None
                update = False

            runner_type_api = RunnerTypeAPI(**runner_type)
            runner_type_api.validate()
            runner_type_model = RunnerTypeAPI.to_model(runner_type_api)

            if runner_type_db:
                runner_type_model.id = runner_type_db.id

            try:
                runner_type_db = RunnerType.add_or_update(runner_type_model)

                extra = {'runner_type_db': runner_type_db}
                if update:
                    LOG.audit('RunnerType updated. RunnerType %s',
                              runner_type_db,
                              extra=extra)
                else:
                    LOG.audit('RunnerType created. RunnerType %s',
                              runner_type_db,
                              extra=extra)
            except Exception:
                LOG.exception('Unable to register runner type %s.',
                              runner_type['name'])

    LOG.debug('End : register default RunnerTypes.')
コード例 #12
0
ファイル: runnersregistrar.py プロジェクト: rgaertner/st2
def register_runner_types(experimental=False):
    """
    :param experimental: True to also register experimental runners.
    :type experimental: ``bool``
    """
    LOG.debug('Start : register default RunnerTypes.')

    for runner_type in RUNNER_TYPES:
        runner_type = copy.deepcopy(runner_type)

        # For backward compatibility reasons, we also register runners under the old names
        runner_names = [runner_type['name']] + runner_type.get('aliases', [])
        for runner_name in runner_names:
            runner_type['name'] = runner_name
            runner_experimental = runner_type.get('experimental', False)

            if runner_experimental and not experimental:
                LOG.debug('Skipping experimental runner "%s"' % (runner_name))
                continue

            # Remove additional, non db-model attributes
            non_db_attributes = ['experimental', 'aliases']
            for attribute in non_db_attributes:
                if attribute in runner_type:
                    del runner_type[attribute]

            try:
                runner_type_db = get_runnertype_by_name(runner_name)
                update = True
            except StackStormDBObjectNotFoundError:
                runner_type_db = None
                update = False

            runner_type_api = RunnerTypeAPI(**runner_type)
            runner_type_api.validate()
            runner_type_model = RunnerTypeAPI.to_model(runner_type_api)

            if runner_type_db:
                runner_type_model.id = runner_type_db.id

            try:
                runner_type_db = RunnerType.add_or_update(runner_type_model)

                extra = {'runner_type_db': runner_type_db}
                if update:
                    LOG.audit('RunnerType updated. RunnerType %s', runner_type_db, extra=extra)
                else:
                    LOG.audit('RunnerType created. RunnerType %s', runner_type_db, extra=extra)
            except Exception:
                LOG.exception('Unable to register runner type %s.', runner_type['name'])

    LOG.debug('End : register default RunnerTypes.')
コード例 #13
0
 def _create_save_runnertype(metadata=False):
     created = RunnerTypeDB()
     created.name = 'python'
     created.description = ''
     created.enabled = True
     if not metadata:
         created.runner_parameters = {'r1': None, 'r2': None}
     else:
         created.runner_parameters = {
             'r1': {'type': 'object', 'properties': {'r1a': {'type': 'string'}}},
             'r2': {'type': 'string', 'required': True}
         }
     created.runner_module = 'nomodule'
     return RunnerType.add_or_update(created)
コード例 #14
0
ファイル: test_db.py プロジェクト: srenatus/st2
 def _create_save_runnertype(metadata=False):
     created = RunnerTypeDB()
     created.name = 'python'
     created.description = ''
     created.enabled = True
     if not metadata:
         created.runner_parameters = {'r1': None, 'r2': None}
     else:
         created.runner_parameters = {
             'r1': {'type': 'object', 'properties': {'r1a': {'type': 'string'}}},
             'r2': {'type': 'string', 'required': True}
         }
     created.runner_module = 'nomodule'
     return RunnerType.add_or_update(created)
コード例 #15
0
def register_runner_types():
    try:
        default_remote_dir = cfg.CONF.ssh_runner.remote_dir
    except:
        default_remote_dir = '/tmp'

    RUNNER_TYPES = [{
        'name': 'run-local',
        'description': 'A runner to execute local actions as a fixed user.',
        'enabled': True,
        'runner_parameters': {
            'hosts': {
                'description':
                'Fixed to localhost as this action is run locally.',
                'type': 'string',
                'default': 'localhost',
                'immutable': True
            },
            'cmd': {
                'description': 'Arbitrary Linux command to be executed on the '
                'host.',
                'type': 'string'
            },
            'parallel': {
                'description': 'Default to parallel execution.',
                'type': 'boolean',
                'default': True,
                'immutable': True
            },
            'sudo': {
                'description': 'The command will be executed with sudo.',
                'type': 'boolean',
                'default': False
            },
            'dir': {
                'description':
                'The working directory where the command will be '
                'executed on the host.',
                'type': 'string',
                'default': default_remote_dir
            },
            'kwarg_op': {
                'description':
                'Operator to use in front of keyword args i.e. "--" or "-".',
                'type': 'string',
                'default': '--'
            }
        },
        'runner_module': 'st2actions.runners.fabricrunner'
    }, {
        'name': 'run-local-script',
        'description': 'A runner to execute local actions as a fixed user.',
        'enabled': True,
        'runner_parameters': {
            'hosts': {
                'description':
                'Fixed to localhost as this action is run locally.',
                'type': 'string',
                'default': 'localhost',
                'immutable': True
            },
            'parallel': {
                'description': 'Default to parallel execution.',
                'type': 'boolean',
                'default': True,
                'immutable': True
            },
            'sudo': {
                'description': 'The command will be executed with sudo.',
                'type': 'boolean',
                'default': False
            },
            'dir': {
                'description':
                'The working directory where the command will be '
                'executed on the host.',
                'type': 'string',
                'default': default_remote_dir
            },
            'kwarg_op': {
                'description':
                'Operator to use in front of keyword args i.e. "--" or "-".',
                'type': 'string',
                'default': '--'
            }
        },
        'runner_module': 'st2actions.runners.fabricrunner'
    }, {
        'name':
        'run-remote',
        'description':
        'A remote execution runner that executes actions '
        'as a fixed system user.',
        'enabled':
        True,
        'runner_parameters': {
            'hosts': {
                'description': 'A comma delimited string of a list of hosts '
                'where the remote command will be executed.',
                'type': 'string',
                'required': True
            },
            'cmd': {
                'description': 'Arbitrary Linux command to be executed on the '
                'remote host(s).',
                'type': 'string'
            },
            'parallel': {
                'description': 'Default to parallel execution.',
                'type': 'boolean',
                'default': True,
                'immutable': True
            },
            'sudo': {
                'description':
                'The remote command will be executed with sudo.',
                'type': 'boolean'
            },
            'dir': {
                'description':
                'The working directory where the command will be '
                'executed on the remote host.',
                'type': 'string',
                'default': default_remote_dir
            },
            'kwarg_op': {
                'description':
                'Operator to use in front of keyword args i.e. "--" or "-".',
                'type': 'string',
                'default': '--'
            }
        },
        'runner_module':
        'st2actions.runners.fabricrunner'
    }, {
        'name':
        'run-remote-script',
        'description':
        'A remote execution runner that executes actions '
        'as a fixed system user.',
        'enabled':
        True,
        'runner_parameters': {
            'hosts': {
                'description': 'A comma delimited string of a list of hosts '
                'where the remote command will be executed.',
                'type': 'string',
                'required': True
            },
            'parallel': {
                'description': 'Default to parallel execution.',
                'type': 'boolean',
                'default': True,
                'immutable': True
            },
            'sudo': {
                'description':
                'The remote command will be executed with sudo.',
                'type': 'boolean'
            },
            'dir': {
                'description':
                'The working directory where the command will be '
                'executed on the remote host.',
                'type': 'string',
                'default': default_remote_dir
            },
            'kwarg_op': {
                'description':
                'Operator to use in front of keyword args i.e. "--" or "-".',
                'type': 'string',
                'default': '--'
            }
        },
        'runner_module':
        'st2actions.runners.fabricrunner'
    }, {
        'name': 'http-runner',
        'description': 'A HTTP client for running HTTP actions.',
        'enabled': True,
        'runner_parameters': {
            'url': {
                'description': 'URL to the HTTP endpoint.',
                'type': 'string',
                'required': True
            },
            'headers': {
                'description': 'HTTP headers for the request.',
                'type': 'string'
            },
            'cookies': {
                'description': 'TODO: Description for cookies.',
                'type': 'string'
            },
            'proxy': {
                'description': 'TODO: Description for proxy.',
                'type': 'string'
            },
            'redirects': {
                'description': 'TODO: Description for redirects.',
                'type': 'string'
            },
        },
        'runner_module': 'st2actions.runners.httprunner'
    }, {
        'name': 'mistral-v1',
        'description': 'A runner for executing mistral v1 workflow.',
        'enabled': True,
        'runner_parameters': {
            'workbook': {
                'description': 'The name of the workbook.',
                'type': 'string',
                'required': True
            },
            'task': {
                'description': 'The startup task in the workbook to execute.',
                'type': 'string',
                'required': True
            },
            'context': {
                'description': 'Context for the startup task.',
                'type': 'object',
                'default': {}
            }
        },
        'runner_module': 'st2actions.runners.mistral.v1'
    }, {
        'name': 'mistral-v2',
        'description': 'A runner for executing mistral v2 workflow.',
        'enabled': True,
        'runner_parameters': {
            'workflow': {
                'description': 'The name of the workflow.',
                'type': 'string',
                'required': True
            },
            'context': {
                'description': 'Context for the startup task.',
                'type': 'object',
                'default': {}
            }
        },
        'runner_module': 'st2actions.runners.mistral.v2'
    }, {
        'name': 'action-chain',
        'description': 'A runner for launching linear action chains.',
        'enabled': True,
        'runner_parameters': {},
        'runner_module': 'st2actions.runners.actionchainrunner'
    }, {
        'name': 'run-python',
        'description': 'A runner for launching python actions.',
        'enabled': True,
        'runner_parameters': {},
        'runner_module': 'st2actions.runners.pythonrunner'
    }]

    LOG.info('Start : register default RunnerTypes.')

    for runnertype in RUNNER_TYPES:
        try:
            runnertype_db = get_runnertype_by_name(runnertype['name'])
            if runnertype_db:
                LOG.info('RunnerType name=%s exists.', runnertype['name'])
                continue
        except StackStormDBObjectNotFoundError:
            pass

        runnertype_api = RunnerTypeAPI(**runnertype)
        try:
            runnertype_db = RunnerType.add_or_update(
                RunnerTypeAPI.to_model(runnertype_api))
            LOG.audit('RunnerType created. RunnerType %s', runnertype_db)
        except Exception:
            LOG.exception('Unable to register runner type %s.',
                          runnertype['name'])

    LOG.info('End : register default RunnerTypes.')
コード例 #16
0
ファイル: test_action.py プロジェクト: BlazeMediaGroup/st2
 def setUpClass(cls):
     super(TestActionExecutionService, cls).setUpClass()
     cls.runner = RunnerTypeAPI(**RUNNER)
     cls.runnerdb = RunnerType.add_or_update(RunnerTypeAPI.to_model(cls.runner))
     cls.action = ActionAPI(**ACTION)
     cls.actiondb = Action.add_or_update(ActionAPI.to_model(cls.action))
コード例 #17
0
ファイル: runnersregistrar.py プロジェクト: bjoernbessert/st2
def register_runner_types():
    try:
        default_remote_dir = cfg.CONF.ssh_runner.remote_dir
    except:
        default_remote_dir = '/tmp'

    RUNNER_TYPES = [
        {
            'name': 'run-local',
            'description': 'A runner to execute local actions as a fixed user.',
            'enabled': True,
            'runner_parameters': {
                'hosts': {
                    'description': 'Fixed to localhost as this action is run locally.',
                    'type': 'string',
                    'default': 'localhost',
                    'immutable': True
                },
                'cmd': {
                    'description': 'Arbitrary Linux command to be executed on the '
                                   'host.',
                    'type': 'string'
                },
                'parallel': {
                    'description': 'Default to parallel execution.',
                    'type': 'boolean',
                    'default': True,
                    'immutable': True
                },
                'sudo': {
                    'description': 'The command will be executed with sudo.',
                    'type': 'boolean',
                    'default': False
                },
                'dir': {
                    'description': 'The working directory where the command will be '
                                   'executed on the host.',
                    'type': 'string',
                    'default': default_remote_dir
                },
                'kwarg_op': {
                    'description': 'Operator to use in front of keyword args i.e. "--" or "-".',
                    'type': 'string',
                    'default': '--'
                }
            },
            'runner_module': 'st2actions.runners.fabricrunner'
        },
        {
            'name': 'run-local-script',
            'description': 'A runner to execute local actions as a fixed user.',
            'enabled': True,
            'runner_parameters': {
                'hosts': {
                    'description': 'Fixed to localhost as this action is run locally.',
                    'type': 'string',
                    'default': 'localhost',
                    'immutable': True
                },
                'parallel': {
                    'description': 'Default to parallel execution.',
                    'type': 'boolean',
                    'default': True,
                    'immutable': True
                },
                'sudo': {
                    'description': 'The command will be executed with sudo.',
                    'type': 'boolean',
                    'default': False
                },
                'dir': {
                    'description': 'The working directory where the command will be '
                                   'executed on the host.',
                    'type': 'string',
                    'default': default_remote_dir
                },
                'kwarg_op': {
                    'description': 'Operator to use in front of keyword args i.e. "--" or "-".',
                    'type': 'string',
                    'default': '--'
                }
            },
            'runner_module': 'st2actions.runners.fabricrunner'
        },
        {
            'name': 'run-remote',
            'description': 'A remote execution runner that executes actions '
                           'as a fixed system user.',
            'enabled': True,
            'runner_parameters': {
                'hosts': {
                    'description': 'A comma delimited string of a list of hosts '
                                   'where the remote command will be executed.',
                    'type': 'string',
                    'required': True
                },
                'cmd': {
                    'description': 'Arbitrary Linux command to be executed on the '
                                   'remote host(s).',
                    'type': 'string'
                },
                'parallel': {
                    'description': 'Default to parallel execution.',
                    'type': 'boolean',
                    'default': True,
                    'immutable': True
                },
                'sudo': {
                    'description': 'The remote command will be executed with sudo.',
                    'type': 'boolean'
                },
                'dir': {
                    'description': 'The working directory where the command will be '
                                   'executed on the remote host.',
                    'type': 'string',
                    'default': default_remote_dir
                },
                'kwarg_op': {
                    'description': 'Operator to use in front of keyword args i.e. "--" or "-".',
                    'type': 'string',
                    'default': '--'
                }
            },
            'runner_module': 'st2actions.runners.fabricrunner'
        },
        {
            'name': 'run-remote-script',
            'description': 'A remote execution runner that executes actions '
                           'as a fixed system user.',
            'enabled': True,
            'runner_parameters': {
                'hosts': {
                    'description': 'A comma delimited string of a list of hosts '
                                   'where the remote command will be executed.',
                    'type': 'string',
                    'required': True
                },
                'parallel': {
                    'description': 'Default to parallel execution.',
                    'type': 'boolean',
                    'default': True,
                    'immutable': True
                },
                'sudo': {
                    'description': 'The remote command will be executed with sudo.',
                    'type': 'boolean'
                },
                'dir': {
                    'description': 'The working directory where the command will be '
                                   'executed on the remote host.',
                    'type': 'string',
                    'default': default_remote_dir
                },
                'kwarg_op': {
                    'description': 'Operator to use in front of keyword args i.e. "--" or "-".',
                    'type': 'string',
                    'default': '--'
                }
            },
            'runner_module': 'st2actions.runners.fabricrunner'
        },
        {
            'name': 'http-runner',
            'description': 'A HTTP client for running HTTP actions.',
            'enabled': True,
            'runner_parameters': {
                'url': {
                    'description': 'URL to the HTTP endpoint.',
                    'type': 'string',
                    'required': True
                },
                'headers': {
                    'description': 'HTTP headers for the request.',
                    'type': 'string'
                },
                'cookies': {
                    'description': 'TODO: Description for cookies.',
                    'type': 'string'
                },
                'proxy': {
                    'description': 'TODO: Description for proxy.',
                    'type': 'string'
                },
                'redirects': {
                    'description': 'TODO: Description for redirects.',
                    'type': 'string'
                },
            },
            'runner_module': 'st2actions.runners.httprunner'
        },
        {
            'name': 'mistral-v1',
            'description': 'A runner for executing mistral v1 workflow.',
            'enabled': True,
            'runner_parameters': {
                'workbook': {
                    'description': 'The name of the workbook.',
                    'type': 'string',
                    'required': True
                },
                'task': {
                    'description': 'The startup task in the workbook to execute.',
                    'type': 'string',
                    'required': True
                },
                'context': {
                    'description': 'Context for the startup task.',
                    'type': 'object',
                    'default': {}
                }
            },
            'runner_module': 'st2actions.runners.mistral.v1'
        },
        {
            'name': 'mistral-v2',
            'description': 'A runner for executing mistral v2 workflow.',
            'enabled': True,
            'runner_parameters': {
                'workflow': {
                    'description': 'The name of the workflow.',
                    'type': 'string',
                    'required': True
                },
                'context': {
                    'description': 'Context for the startup task.',
                    'type': 'object',
                    'default': {}
                }
            },
            'runner_module': 'st2actions.runners.mistral.v2'
        },
        {
            'name': 'action-chain',
            'description': 'A runner for launching linear action chains.',
            'enabled': True,
            'runner_parameters': {},
            'runner_module': 'st2actions.runners.actionchainrunner'
        },
        {
            'name': 'run-python',
            'description': 'A runner for launching python actions.',
            'enabled': True,
            'runner_parameters': {},
            'runner_module': 'st2actions.runners.pythonrunner'
        }
    ]

    LOG.info('Start : register default RunnerTypes.')

    for runnertype in RUNNER_TYPES:
        try:
            runnertype_db = get_runnertype_by_name(runnertype['name'])
            if runnertype_db:
                LOG.info('RunnerType name=%s exists.', runnertype['name'])
                continue
        except StackStormDBObjectNotFoundError:
            pass

        runnertype_api = RunnerTypeAPI(**runnertype)
        try:
            runnertype_db = RunnerType.add_or_update(RunnerTypeAPI.to_model(runnertype_api))
            LOG.audit('RunnerType created. RunnerType %s', runnertype_db)
        except Exception:
            LOG.exception('Unable to register runner type %s.', runnertype['name'])

    LOG.info('End : register default RunnerTypes.')