attempt to properly clean up runner ansible_pi directories

This commit is contained in:
Ryan Petrello 2019-07-31 17:08:07 -04:00
parent a36b436414
commit cfeedb158e
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
2 changed files with 10 additions and 2 deletions

View File

@ -864,9 +864,17 @@ class BaseTask(object):
# Help the user out by including the collections path inside the bubblewrap environment
if getattr(settings, 'AWX_ANSIBLE_COLLECTIONS_PATHS', []):
show_paths.extend(settings.AWX_ANSIBLE_COLLECTIONS_PATHS)
pi_path = tempfile.mkdtemp(
prefix='ansible_runner_pi_',
dir=settings.AWX_PROOT_BASE_PATH
)
os.chmod(pi_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
self.cleanup_paths.append(pi_path)
process_isolation_params = {
'process_isolation': True,
'process_isolation_path': settings.AWX_PROOT_BASE_PATH,
'process_isolation_path': pi_path,
'process_isolation_show_paths': show_paths,
'process_isolation_hide_paths': [
settings.AWX_PROOT_BASE_PATH,

View File

@ -445,7 +445,7 @@ class TestGenericRun():
process_isolation_params = task.build_params_process_isolation(job, private_data_dir, cwd)
assert True is process_isolation_params['process_isolation']
assert settings.AWX_PROOT_BASE_PATH == process_isolation_params['process_isolation_path'], \
assert process_isolation_params['process_isolation_path'].startswith(settings.AWX_PROOT_BASE_PATH), \
"Directory where a temp directory will be created for the remapping to take place"
assert private_data_dir in process_isolation_params['process_isolation_show_paths'], \
"The per-job private data dir should be in the list of directories the user can see."