Browse Source

Merge "Constants path formatting unification"

changes/93/795093/8
Zuul 5 days ago
committed by Gerrit Code Review
parent
commit
1d33aa38f6
2 changed files with 11 additions and 6 deletions
  1. +6
    -3
      validations_libs/constants.py
  2. +5
    -3
      validations_libs/utils.py

+ 6
- 3
validations_libs/constants.py 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')

+ 5
- 3
validations_libs/utils.py 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


Loading…
Cancel
Save