Browse Source

add validations logs path cache

changes/53/712253/1
Mathieu Bultel 2 years ago
parent
commit
582d31dacf
  1. 4
      validations_libs/ansible.py
  2. 4
      validations_libs/constants.py
  3. 4
      validations_libs/run.py

4
validations_libs/ansible.py

@ -20,6 +20,7 @@ import os
import six
import sys
import tempfile
import uuid
import yaml
from six.moves import configparser
@ -297,7 +298,8 @@ class Ansible(object):
command_path = None
with utils.TempDirs(chdir=False) as ansible_artifact_path:
with utils.TempDirs(dir_path=constants.VALIDATION_RUN_LOG_PATH,
chdir=False,) as ansible_artifact_path:
if 'ANSIBLE_CONFIG' not in env and not ansible_cfg:
ansible_cfg = os.path.join(ansible_artifact_path, 'ansible.cfg')
config = configparser.ConfigParser()

4
validations_libs/constants.py

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
#
DEFAULT_VALIDATIONS_BASEDIR = '/usr/share/validations-common'
ANSIBLE_VALIDATION_DIR = '/usr/share/validations-common/playbooks'
@ -23,3 +21,5 @@ VALIDATION_GROUPS_INFO = '%s/groups.yaml' % DEFAULT_VALIDATIONS_BASEDIR
VALIDATION_GROUPS = ['no-op',
'prep',
'post']
VALIDATION_RUN_LOG_PATH = '/var/lib/validations/logs'

4
validations_libs/run.py

@ -32,7 +32,7 @@ class Run(object):
def run_validations(self, playbook, inventory,
group=None, extra_vars=None, validations_dir=None,
validation_name=None, extra_env_var=None,
ansible_cfg=None):
ansible_cfg=None, quiet=True):
self.log = logging.getLogger(__name__ + ".run_validations")
@ -71,7 +71,7 @@ class Run(object):
parallel_run=True,
inventory=inventory,
output_callback='validation_json',
quiet=True,
quiet=quiet,
extra_vars=extra_vars,
extra_env_variables=extra_env_var,
ansible_cfg=ansible_cfg,

Loading…
Cancel
Save