mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
start on path helper methods
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from awx.main.models.execution_environments import ExecutionEnvironment
|
||||
@@ -25,3 +28,16 @@ def get_default_pod_spec():
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
# this is the root of the private data dir as seen from inside
|
||||
# of the container running a job
|
||||
CONTAINER_ROOT = '/runner'
|
||||
|
||||
|
||||
def to_container_path(path, private_data_dir):
|
||||
if not os.path.isabs(private_data_dir):
|
||||
raise Exception
|
||||
if Path(private_data_dir) not in Path(path).parents:
|
||||
raise Exception
|
||||
return path.replace(private_data_dir, CONTAINER_ROOT)
|
||||
|
||||
Reference in New Issue
Block a user