Merge "Constants path formatting unification"

This commit is contained in:
Zuul 2021-06-07 19:15:11 +00:00 committed by Gerrit Code Review
commit 1d33aa38f6
2 changed files with 11 additions and 6 deletions

View File

@ -18,9 +18,12 @@ DEFAULT_VALIDATIONS_BASEDIR = '/usr/share/ansible'
ANSIBLE_VALIDATION_DIR = '/usr/share/ansible/validation-playbooks'
VALIDATION_GROUPS_INFO = '%s/groups.yaml' % DEFAULT_VALIDATIONS_BASEDIR
VALIDATION_GROUPS_INFO = os.path.join(
DEFAULT_VALIDATIONS_BASEDIR,
'groups.yaml')
VALIDATIONS_LOG_BASEDIR = os.path.join(os.environ.get('HOME'), 'validations')
VALIDATION_ANSIBLE_ARTIFACT_PATH = '{}/artifacts/'.format(
VALIDATIONS_LOG_BASEDIR)
VALIDATION_ANSIBLE_ARTIFACT_PATH = os.path.join(
VALIDATIONS_LOG_BASEDIR,
'artifacts')

View File

@ -66,7 +66,7 @@ def create_artifacts_dir(log_path=constants.VALIDATIONS_LOG_BASEDIR,
:type log_path: `string`
:param prefix: Playbook name
:type prefix: `string`
:return: The UUID of the validation and the absolute Path of the log file
:return: The UUID of the validation and the absolute path of the log file
:rtype: `string`, `string`
"""
artifact_dir = os.path.join(log_path, 'artifacts')
@ -79,11 +79,13 @@ def create_artifacts_dir(log_path=constants.VALIDATIONS_LOG_BASEDIR,
except (OSError, PermissionError):
LOG.exception(
(
"Error while creating Ansible artifacts log file."
"Please check the access rights for {}"
"Error while creating Ansible artifacts directory. "
"Please check the access rights for: '{}'"
).format(log_dir)
)
raise RuntimeError()
def parse_all_validations_on_disk(path, groups=None):
"""Return a list of validations metadata which can be sorted by Groups