mirror of
https://github.com/ansible/awx.git
synced 2026-03-14 07:27:28 -02:30
Renamed scontext variable to mount_options
This commit is contained in:
@@ -164,15 +164,14 @@ class BaseTask(object):
|
||||
# Using z allows the dir to be mounted by multiple containers
|
||||
# Uppercase Z restricts access (in weird ways) to 1 container at a time
|
||||
if this_path.count(':') == MAX_ISOLATED_PATH_COLON_DELIMITER:
|
||||
src, dest, scontext = this_path.split(':')
|
||||
src, dest, mount_option = this_path.split(':')
|
||||
|
||||
# scontext validation via performed via API, but since this can be overriden via settings.py
|
||||
# let's ensure scontext is one that we support
|
||||
if scontext not in CONTAINER_VOLUMES_MOUNT_TYPES:
|
||||
scontext = 'z'
|
||||
logger.warn(f'The path {this_path} has volume mount type {scontext} which is not supported. Using "z" instead.')
|
||||
# mount_option validation via performed via API, but since this can be overriden via settings.py
|
||||
if mount_option not in CONTAINER_VOLUMES_MOUNT_TYPES:
|
||||
mount_option = 'z'
|
||||
logger.warn(f'The path {this_path} has volume mount type {mount_option} which is not supported. Using "z" instead.')
|
||||
|
||||
params['container_volume_mounts'].append(f'{src}:{dest}:{scontext}')
|
||||
params['container_volume_mounts'].append(f'{src}:{dest}:{mount_option}')
|
||||
elif this_path.count(':') == MAX_ISOLATED_PATH_COLON_DELIMITER - 1:
|
||||
src, dest = this_path.split(':')
|
||||
params['container_volume_mounts'].append(f'{src}:{dest}:z')
|
||||
|
||||
@@ -500,9 +500,9 @@ class AWXReceptorJob:
|
||||
spec_volumes = []
|
||||
|
||||
for idx, this_path in enumerate(settings.AWX_ISOLATION_SHOW_PATHS):
|
||||
scontext = None
|
||||
mount_option = None
|
||||
if this_path.count(':') == MAX_ISOLATED_PATH_COLON_DELIMITER:
|
||||
src, dest, scontext = this_path.split(':')
|
||||
src, dest, mount_option = this_path.split(':')
|
||||
elif this_path.count(':') == MAX_ISOLATED_PATH_COLON_DELIMITER - 1:
|
||||
src, dest = this_path.split(':')
|
||||
else:
|
||||
@@ -512,7 +512,7 @@ class AWXReceptorJob:
|
||||
# We do this so we can use the same configuration for regular scenarios and k8s
|
||||
# Since flags like ':O', ':z' or ':Z' are not valid in the k8s realm
|
||||
# Example: /data:/data:ro
|
||||
read_only = bool('ro' == scontext)
|
||||
read_only = bool('ro' == mount_option)
|
||||
|
||||
# Since type is not being passed, k8s by default will not perform any checks if the
|
||||
# hostPath volume exists on the k8s node itself.
|
||||
|
||||
Reference in New Issue
Block a user