diff --git a/src/core/pyros_django/majordome/agent/A_SST.py b/src/core/pyros_django/majordome/agent/A_SST.py index 033a0fe..33615ac 100644 --- a/src/core/pyros_django/majordome/agent/A_SST.py +++ b/src/core/pyros_django/majordome/agent/A_SST.py @@ -149,7 +149,7 @@ class A_SST(Agent): agent_informations = obs_config.get_agent_information(obs_config.unit_name,agent) protocol = agent_informations.get("protocol") if protocol: - protocol_folder_abs_path = os.path.join(os.environ.get("PATH_TO_OBSCONF_FOLDER"), "..", "agents") + protocol_folder_abs_path = os.path.join(os.environ.get("PATH_TO_OBSCONF_FOLDER"), "agents") protocol_script_name = protocol protocol = os.path.join(protocol_folder_abs_path, protocol_script_name) else: @@ -159,9 +159,11 @@ class A_SST(Agent): if general_agent_name[0] in agent: protocol_folder_abs_path = os.path.abspath(os.path.dirname(general_agent)) protocol_script_name = os.path.basename(general_agent) + print(protocol_folder_abs_path) + print(protocol_script_name) protocol = os.path.join(protocol_folder_abs_path, protocol_script_name) break - + print(protocol) if os.path.exists(protocol): cmd = self.VENV_PYTHON +" "+ protocol_folder_abs_path + os.sep + protocol_script_name if not agent in self.agent_in_mode_test: @@ -204,7 +206,7 @@ class A_SST(Agent): protocol_script_name = "" protocol_folder_abs_path = "" if protocol and is_active == True: - protocol_folder_abs_path = os.path.join(os.environ.get("PATH_TO_OBSCONF_FOLDER"), "..", "agents") + protocol_folder_abs_path = os.path.join(os.environ.get("PATH_TO_OBSCONF_FOLDER"), "agents") protocol_script_name = protocol protocol = os.path.join(protocol_folder_abs_path, protocol_script_name) else: @@ -217,7 +219,7 @@ class A_SST(Agent): protocol_script_name = os.path.basename(general_agent) protocol = os.path.join(protocol_folder_abs_path, protocol_script_name) break - if os.path.exists(protocol): + if protocol and os.path.exists(protocol): cmd = self.VENV_PYTHON +" "+ protocol if not agent in self.agent_in_mode_test: @@ -393,9 +395,17 @@ class A_SST(Agent): self.send_cmd_to(self.name,"do_restart_agent", agent) log.info("Check status of process") + nb_stopped_agent = 0 for agent in self.subprocess_dict: proc = self.subprocess_dict.get(agent).get("process") log.info(f"{agent} poll result is {proc.poll()}") + if proc.poll() is not None: + nb_stopped_agent +=1 + if self.TEST_MODE: + if nb_stopped_agent == len(self.subprocess_dict.keys()): + print("All launched agents have finished their test modes, A_SST will stop") + self.do_stop("asap") + -- libgit2 0.21.2