[stable/train] Add support for the validations skip list feature
This patch adds a new --skiplist argument to the run sub command. This feature allows the operator to provide a file with a list of Validations to skip via the run sub command. More details could be found in the official validations-libs documentation [1]. PS: To avoid requirements and upper constraints headache, this patch will not use validations_libs.cli.common.read_cli_data_file() coming from recent validations-libs release but the skip list file will be open and read directly in the tripleo_validator.py. Depends-On: https://review.opendev.org/c/openstack/validations-libs/+/809289 [1] - https://docs.openstack.org/validations-libs/latest/readme.html#skip-list Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com> Change-Id: Ibe6d56fc4eea93ab333fab237aa22e554fc245f3 (cherry picked from commitb7e50a9a15
) (cherry picked from commit70883be45e
)
This commit is contained in:
parent
fc4901f6e4
commit
c13638dcb1
|
@ -275,6 +275,18 @@ class TripleOValidatorRun(command.Command):
|
|||
)
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--skiplist',
|
||||
dest='skip_list',
|
||||
default=None,
|
||||
help=_(
|
||||
"Path where the skip list is stored. "
|
||||
"An example of the skiplist format could "
|
||||
"be found at the root of the "
|
||||
"validations-libs repository."
|
||||
)
|
||||
)
|
||||
|
||||
extra_vars_group = parser.add_mutually_exclusive_group(required=False)
|
||||
|
||||
extra_vars_group.add_argument(
|
||||
|
@ -414,6 +426,20 @@ class TripleOValidatorRun(command.Command):
|
|||
undercloud_connection='local',
|
||||
return_inventory_file_path=True)
|
||||
|
||||
skip_list = None
|
||||
if parsed_args.skip_list:
|
||||
try:
|
||||
with open(parsed_args.skip_list, 'r') as _file:
|
||||
skip_list = yaml.safe_load(_file.read())
|
||||
except (yaml.YAMLError, IOError) as error:
|
||||
error_msg = (
|
||||
"The file {} must be properly formatted YAML/JSON."
|
||||
"Details: {}.").format(parsed_args.skip_list, error)
|
||||
raise RuntimeError(error_msg)
|
||||
|
||||
if not isinstance(skip_list, dict):
|
||||
raise RuntimeError("Wrong format for the skiplist.")
|
||||
|
||||
v_consts.DEFAULT_VALIDATIONS_BASEDIR = constants.\
|
||||
DEFAULT_VALIDATIONS_BASEDIR
|
||||
actions = ValidationActions()
|
||||
|
@ -427,7 +453,8 @@ class TripleOValidatorRun(command.Command):
|
|||
validation_name=parsed_args.validation_name,
|
||||
extra_env_vars=extra_env_vars,
|
||||
python_interpreter=parsed_args.python_interpreter,
|
||||
quiet=quiet_mode)
|
||||
quiet=quiet_mode,
|
||||
skip_list=skip_list)
|
||||
except RuntimeError as e:
|
||||
raise exceptions.CommandError(e)
|
||||
|
||||
|
|
Loading…
Reference in New Issue