Add a way to override the default validation log path
Export a log path passed by the user in order to override the default value from the callback Change-Id: I736c527254cf17d25eeda0a4007102838280609c
This commit is contained in:
parent
df1ca74542
commit
15e74046c1
|
@ -279,7 +279,8 @@ class Ansible(object):
|
||||||
gathering_policy='smart',
|
gathering_policy='smart',
|
||||||
extra_env_variables=None, parallel_run=False,
|
extra_env_variables=None, parallel_run=False,
|
||||||
callback_whitelist=None, ansible_cfg=None,
|
callback_whitelist=None, ansible_cfg=None,
|
||||||
ansible_timeout=30, ansible_artifact_path=None, run_async=False):
|
ansible_timeout=30, ansible_artifact_path=None,
|
||||||
|
log_path=None, run_async=False):
|
||||||
|
|
||||||
if not playbook_dir:
|
if not playbook_dir:
|
||||||
playbook_dir = workdir
|
playbook_dir = workdir
|
||||||
|
@ -318,6 +319,9 @@ class Ansible(object):
|
||||||
elif 'ANSIBLE_CONFIG' not in env and ansible_cfg:
|
elif 'ANSIBLE_CONFIG' not in env and ansible_cfg:
|
||||||
env['ANSIBLE_CONFIG'] = ansible_cfg
|
env['ANSIBLE_CONFIG'] = ansible_cfg
|
||||||
|
|
||||||
|
if log_path:
|
||||||
|
env['VALIDATIONS_LOG_DIR'] = log_path
|
||||||
|
|
||||||
envvars = self._encode_envvars(env=env)
|
envvars = self._encode_envvars(env=env)
|
||||||
r_opts = {
|
r_opts = {
|
||||||
'private_data_dir': workdir,
|
'private_data_dir': workdir,
|
||||||
|
|
|
@ -67,7 +67,8 @@ class ValidationActions(object):
|
||||||
group=None, extra_vars=None, validations_dir=None,
|
group=None, extra_vars=None, validations_dir=None,
|
||||||
extra_env_vars=None, ansible_cfg=None, quiet=True,
|
extra_env_vars=None, ansible_cfg=None, quiet=True,
|
||||||
workdir=None, limit_hosts=None, run_async=False,
|
workdir=None, limit_hosts=None, run_async=False,
|
||||||
base_dir=constants.DEFAULT_VALIDATIONS_BASEDIR):
|
base_dir=constants.DEFAULT_VALIDATIONS_BASEDIR,
|
||||||
|
log_path=None):
|
||||||
self.log = logging.getLogger(__name__ + ".run_validations")
|
self.log = logging.getLogger(__name__ + ".run_validations")
|
||||||
playbooks = []
|
playbooks = []
|
||||||
validations_dir = (validations_dir if validations_dir
|
validations_dir = (validations_dir if validations_dir
|
||||||
|
@ -113,6 +114,7 @@ class ValidationActions(object):
|
||||||
ansible_cfg=ansible_cfg,
|
ansible_cfg=ansible_cfg,
|
||||||
gathering_policy='explicit',
|
gathering_policy='explicit',
|
||||||
ansible_artifact_path=artifacts_dir,
|
ansible_artifact_path=artifacts_dir,
|
||||||
|
log_path=log_path,
|
||||||
run_async=run_async)
|
run_async=run_async)
|
||||||
results.append({'playbook': _playbook,
|
results.append({'playbook': _playbook,
|
||||||
'rc_code': _rc,
|
'rc_code': _rc,
|
||||||
|
|
Loading…
Reference in New Issue