mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
Merge pull request #495 from ryanpetrello/fix-7713
work around an ansible 2.4 inventory caching bug
This commit is contained in:
commit
e48bebb761
@ -702,7 +702,12 @@ class BaseTask(LogErrorsTask):
|
||||
os.chmod(path, stat.S_IRUSR | stat.S_IXUSR)
|
||||
return path
|
||||
else:
|
||||
return plugin
|
||||
# work around an inventory caching bug in Ansible 2.4.0
|
||||
# see: https://github.com/ansible/ansible/pull/30817
|
||||
# see: https://github.com/ansible/awx/issues/246
|
||||
inventory_script = tempfile.mktemp(suffix='.awxrest.py', dir=kwargs['private_data_dir'])
|
||||
shutil.copy(plugin, inventory_script)
|
||||
return inventory_script
|
||||
|
||||
def build_args(self, instance, **kwargs):
|
||||
raise NotImplementedError
|
||||
|
@ -1,3 +1,4 @@
|
||||
import tempfile
|
||||
import pytest
|
||||
import json
|
||||
|
||||
@ -62,7 +63,7 @@ def test_survey_passwords_not_in_extra_vars():
|
||||
|
||||
def test_job_safe_args_redacted_passwords(job):
|
||||
"""Verify that safe_args hides passwords in the job extra_vars"""
|
||||
kwargs = {'ansible_version': '2.1'}
|
||||
kwargs = {'ansible_version': '2.1', 'private_data_dir': tempfile.mkdtemp()}
|
||||
run_job = RunJob()
|
||||
safe_args = run_job.build_safe_args(job, **kwargs)
|
||||
ev_index = safe_args.index('-e') + 1
|
||||
@ -70,8 +71,8 @@ def test_job_safe_args_redacted_passwords(job):
|
||||
assert extra_vars['secret_key'] == '$encrypted$'
|
||||
|
||||
|
||||
def test_job_args_unredacted_passwords(job):
|
||||
kwargs = {'ansible_version': '2.1'}
|
||||
def test_job_args_unredacted_passwords(job, tmpdir_factory):
|
||||
kwargs = {'ansible_version': '2.1', 'private_data_dir': tempfile.mkdtemp()}
|
||||
run_job = RunJob()
|
||||
args = run_job.build_args(job, **kwargs)
|
||||
ev_index = args.index('-e') + 1
|
||||
|
Loading…
Reference in New Issue
Block a user