add validations logs path cache

This commit is contained in:
Mathieu Bultel 2020-03-05 17:29:12 +01:00
parent 0c8ea35843
commit 582d31dacf
3 changed files with 7 additions and 5 deletions

View File

@ -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()

View File

@ -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'

View File

@ -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,