mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 13:36:02 -03:30
Respect user proot show paths when using containers
This commit is contained in:
committed by
Shane McDonald
parent
50433789ae
commit
6e2010ca40
@@ -887,7 +887,12 @@ class BaseTask(object):
|
|||||||
return os.path.abspath(os.path.join(os.path.dirname(__file__), *args))
|
return os.path.abspath(os.path.join(os.path.dirname(__file__), *args))
|
||||||
|
|
||||||
def build_execution_environment_params(self, instance):
|
def build_execution_environment_params(self, instance):
|
||||||
return {}
|
params = {}
|
||||||
|
if settings.AWX_PROOT_SHOW_PATHS:
|
||||||
|
params['container_volume_mounts'] = []
|
||||||
|
for this_path in settings.AWX_PROOT_SHOW_PATHS:
|
||||||
|
params['container_volume_mounts'].append(f'{this_path}:{this_path}:Z')
|
||||||
|
return params
|
||||||
|
|
||||||
def build_private_data(self, instance, private_data_dir):
|
def build_private_data(self, instance, private_data_dir):
|
||||||
'''
|
'''
|
||||||
@@ -1990,11 +1995,12 @@ class RunJob(BaseTask):
|
|||||||
update_inventory_computed_fields.delay(inventory.id)
|
update_inventory_computed_fields.delay(inventory.id)
|
||||||
|
|
||||||
def build_execution_environment_params(self, instance):
|
def build_execution_environment_params(self, instance):
|
||||||
execution_environment_params = {
|
params = super(RunJob, self).build_execution_environment_params(instance)
|
||||||
|
params.update({
|
||||||
"container_image": settings.AWX_EXECUTION_ENVIRONMENT_DEFAULT_IMAGE,
|
"container_image": settings.AWX_EXECUTION_ENVIRONMENT_DEFAULT_IMAGE,
|
||||||
"process_isolation": True
|
"process_isolation": True
|
||||||
}
|
})
|
||||||
return execution_environment_params
|
return params
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2482,18 +2488,17 @@ class RunProjectUpdate(BaseTask):
|
|||||||
return getattr(settings, 'AWX_PROOT_ENABLED', False)
|
return getattr(settings, 'AWX_PROOT_ENABLED', False)
|
||||||
|
|
||||||
def build_execution_environment_params(self, instance):
|
def build_execution_environment_params(self, instance):
|
||||||
|
params = super(RunProjectUpdate, self).build_execution_environment_params(instance)
|
||||||
project_path = instance.get_project_path(check_if_exists=False)
|
project_path = instance.get_project_path(check_if_exists=False)
|
||||||
cache_path = instance.get_cache_path()
|
cache_path = instance.get_cache_path()
|
||||||
execution_environment_params = {
|
params['process_isolation'] = True
|
||||||
"process_isolation": True,
|
params['container_image'] = settings.AWX_EXECUTION_ENVIRONMENT_DEFAULT_IMAGE
|
||||||
"container_image": settings.AWX_EXECUTION_ENVIRONMENT_DEFAULT_IMAGE,
|
params.setdefault('container_volume_mounts', [])
|
||||||
"container_volume_mounts": [
|
params['container_volume_mounts'].extend([
|
||||||
f"{project_path}:{project_path}:Z",
|
f"{project_path}:{project_path}:Z",
|
||||||
f"{cache_path}:{cache_path}:Z",
|
f"{cache_path}:{cache_path}:Z",
|
||||||
]
|
])
|
||||||
|
return params
|
||||||
}
|
|
||||||
return execution_environment_params
|
|
||||||
|
|
||||||
|
|
||||||
@task(queue=get_local_queuename)
|
@task(queue=get_local_queuename)
|
||||||
|
|||||||
Reference in New Issue
Block a user