Skip to content

Commit

Permalink
change file to dir in mount
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLisin committed Oct 2, 2023
1 parent 988f202 commit ed1b8f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
7 changes: 6 additions & 1 deletion agent/worker/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ def APP_DEBUG_DOCKER_IMAGE():
def REQUESTS_CA_BUNDLE():
return read_optional_setting(_REQUESTS_CA_BUNDLE)

def REQUESTS_CA_BUNDLE_DIR():
if REQUESTS_CA_BUNDLE() is not None:
return os.path.dirname(REQUESTS_CA_BUNDLE())
return None


def MOUNTED_REQUESTS_CA_BUNDLE():
return os.path.join(AGENT_ROOT_DIR(), "certs")
Expand Down Expand Up @@ -508,7 +513,7 @@ def init_constants():
sly.fs.mkdir(SUPERVISELY_SYNCED_APP_DATA_CONTAINER())

if REQUESTS_CA_BUNDLE() is not None:
if os.path.dirname(REQUESTS_CA_BUNDLE()) != MOUNTED_REQUESTS_CA_BUNDLE():
if REQUESTS_CA_BUNDLE_DIR() != MOUNTED_REQUESTS_CA_BUNDLE():
filename = sly.fs.get_file_name_with_ext(REQUESTS_CA_BUNDLE())
sly.fs.mkdir(MOUNTED_REQUESTS_CA_BUNDLE())
sly.fs.copy_file(
Expand Down
8 changes: 1 addition & 7 deletions agent/worker/task_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,10 @@ def _get_task_volumes(self):

if constants.REQUESTS_CA_BUNDLE() is not None:
res[constants.MOUNTED_HOST_REQUESTS_CA_BUNDLE()] = {
"bind": constants.REQUESTS_CA_BUNDLE(),
"bind": constants.REQUESTS_CA_BUNDLE_DIR(),
"mode": "ro",
}

# if constants.HOST_REQUESTS_CA_BUNDLE() is not None: # "${AGENT_HOST_DIR}"/certs
# res[constants.HOST_REQUESTS_CA_BUNDLE()] = {
# "bind": constants.REQUESTS_CA_BUNDLE(), # /sly_agent/certs
# "mode": "ro",
# }

if constants.SUPERVISELY_AGENT_FILES() is not None:
relative_app_data_dir = os.path.join(
"app_data", slugify(self.app_config["name"]), str(self.info["task_id"])
Expand Down
8 changes: 2 additions & 6 deletions agent/worker/task_dockerized.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,10 @@ def _get_task_volumes(self):
}
if constants.REQUESTS_CA_BUNDLE() is not None:
volumes[constants.MOUNTED_HOST_REQUESTS_CA_BUNDLE()] = {
"bind": constants.REQUESTS_CA_BUNDLE(),
"bind": constants.REQUESTS_CA_BUNDLE_DIR(),
"mode": "ro",
}
# if constants.HOST_REQUESTS_CA_BUNDLE() is not None:
# volumes[constants.HOST_REQUESTS_CA_BUNDLE()] = {
# "bind": constants.REQUESTS_CA_BUNDLE(),
# "mode": "ro",
# }

return volumes

def get_spawn_entrypoint(self):
Expand Down

0 comments on commit ed1b8f4

Please sign in to comment.