:param runner_type_db: RunnerTypeDB object belonging to this action. If not provided, it's retrieved from the database. :type runner_type_db: :class:`RunnerTypeDB`
(action_api, runner_type_db=None)
| 33 | |
| 34 | |
| 35 | def validate_action(action_api, runner_type_db=None): |
| 36 | """ |
| 37 | :param runner_type_db: RunnerTypeDB object belonging to this action. If not provided, it's |
| 38 | retrieved from the database. |
| 39 | :type runner_type_db: :class:`RunnerTypeDB` |
| 40 | """ |
| 41 | if not runner_type_db: |
| 42 | runner_db = get_runner_model(action_api) |
| 43 | else: |
| 44 | runner_db = runner_type_db |
| 45 | |
| 46 | # Check if pack is valid. |
| 47 | if not _is_valid_pack(action_api.pack): |
| 48 | packs_base_paths = get_packs_base_paths() |
| 49 | packs_base_paths = ",".join(packs_base_paths) |
| 50 | msg = ( |
| 51 | 'Content pack "%s" is not found or doesn\'t contain actions directory. ' |
| 52 | "Searched in: %s" % (action_api.pack, packs_base_paths) |
| 53 | ) |
| 54 | raise ValueValidationException(msg) |
| 55 | |
| 56 | # Check if parameters defined are valid. |
| 57 | action_ref = ResourceReference.to_string_reference( |
| 58 | pack=action_api.pack, name=action_api.name |
| 59 | ) |
| 60 | _validate_parameters(action_ref, action_api.parameters, runner_db.runner_parameters) |
| 61 | |
| 62 | |
| 63 | def get_runner_model(action_api): |
nothing calls this directly
no test coverage detected