From 9aa64d0b5af56189c094fa95f7fc7626e984be40 Mon Sep 17 00:00:00 2001 From: Nikolai Petukhov Date: Thu, 1 Feb 2024 06:31:49 -0300 Subject: [PATCH] always pass ca cert on update (#62) * always pass ca cert on update * revert debug changes * remove SLY_EXTRA_CA_CERTS from net-client envs if file not found --- agent/main.py | 3 ++- agent/worker/task_update.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/agent/main.py b/agent/main.py index 5605662..8c8e9ff 100644 --- a/agent/main.py +++ b/agent/main.py @@ -97,7 +97,8 @@ def _start_net_client(docker_api=None): if constants.NO_PROXY(): envs.append(f"{constants._NO_PROXY}={constants.NO_PROXY()}") if constants.SLY_EXTRA_CA_CERTS(): - envs.append(f"{constants._SLY_EXTRA_CA_CERTS}={constants.SLY_EXTRA_CA_CERTS()}") + if os.path.exists(constants.SLY_EXTRA_CA_CERTS()): + envs.append(f"{constants._SLY_EXTRA_CA_CERTS}={constants.SLY_EXTRA_CA_CERTS()}") volumes = [ "/var/run/docker.sock:/tmp/docker.sock:ro", f"{constants.HOST_DIR()}:{constants.AGENT_ROOT_DIR()}", diff --git a/agent/worker/task_update.py b/agent/worker/task_update.py index fa69a32..09ddd0f 100644 --- a/agent/worker/task_update.py +++ b/agent/worker/task_update.py @@ -42,6 +42,8 @@ def task_main_func(self): _, _, new_ca_cert_path = agent_utils.get_options_changes(envs, volumes, ca_cert) if new_ca_cert_path and constants.SLY_EXTRA_CA_CERTS() != new_ca_cert_path: envs[constants._SLY_EXTRA_CA_CERTS] = new_ca_cert_path + else: + envs[constants._SLY_EXTRA_CA_CERTS] = constants.SLY_EXTRA_CA_CERTS() use_options = True except agent_utils.AgentOptionsNotAvailable: