Commit 2913310b90df4c66280692c37b7a7f32da95d119

Authored by Alexis Koralewski
1 parent 8a356bfe
Exists in dev

Fix exception Majordome entry not found on AgentSST

Showing 2 changed files with 8 additions and 4 deletions   Show diff stats
1 18-01-2023 (AKo): v0.6.16.1 1 18-01-2023 (AKo): v0.6.16.1
2 - Fix get_all_cmds when it's the first time we're sending it 2 - Fix get_all_cmds when it's the first time we're sending it
3 - 3 + - Fix exception Majordome entry not found on AgentSST
  4 +
4 16-01-2023 (AKo): v0.6.16.0 5 16-01-2023 (AKo): v0.6.16.0
5 - Change redis container name to pyros-redis 6 - Change redis container name to pyros-redis
6 - Renaming HOST_NAME env variable to WEBSERVER_HOST_NAME to avoid confusion 7 - Renaming HOST_NAME env variable to WEBSERVER_HOST_NAME to avoid confusion
src/core/pyros_django/agent/AgentSST.py
@@ -59,20 +59,22 @@ class AgentSST(Agent): @@ -59,20 +59,22 @@ class AgentSST(Agent):
59 if simulated_computer != None: 59 if simulated_computer != None:
60 self.computer = simulated_computer 60 self.computer = simulated_computer
61 self.simulated_computer = simulated_computer 61 self.simulated_computer = simulated_computer
  62 + print(self.computer)
62 name_from_config = self.get_config().get_agent_sst_of_computer(self.computer) 63 name_from_config = self.get_config().get_agent_sst_of_computer(self.computer)
63 if name_from_config != None: 64 if name_from_config != None:
64 name = name_from_config 65 name = name_from_config
65 self.name = name 66 self.name = name
66 if AgentSurvey.objects.filter(name=self.name).exists(): 67 if AgentSurvey.objects.filter(name=self.name).exists():
67 - self._agent_survey = AgentSurvey.objects.get(name=self.name) 68 + self.__agent_survey = AgentSurvey.objects.get(name=self.name)
68 else: 69 else:
69 - self._agent_survey = AgentSurvey.objects.create( 70 + self.__agent_survey = AgentSurvey.objects.create(
70 name=self.name, 71 name=self.name,
71 validity_duration=60, 72 validity_duration=60,
72 mode=self.get_mode(), 73 mode=self.get_mode(),
73 status=self.get_status(), 74 status=self.get_status(),
74 iteration=-1 75 iteration=-1
75 ) 76 )
  77 + print(f"FROM AGENT SST {self.__agent_survey}")
76 WITH_DOCKER = False 78 WITH_DOCKER = False
77 if os.environ.get("WITH_DOCKER"): 79 if os.environ.get("WITH_DOCKER"):
78 WITH_DOCKER = True 80 WITH_DOCKER = True
@@ -296,7 +298,8 @@ class AgentSST(Agent): @@ -296,7 +298,8 @@ class AgentSST(Agent):
296 298
297 # checking status of agent if they are timeout if in auto mode 299 # checking status of agent if they are timeout if in auto mode
298 try: 300 try:
299 - soft_mode = Majordome.objects.last().soft_mode 301 + majordome = Majordome.objects.last()
  302 + soft_mode = majordome.soft_mode
300 except Majordome.DoesNotExist: 303 except Majordome.DoesNotExist:
301 soft_mode = None 304 soft_mode = None
302 if (soft_mode is not None and soft_mode == "AUTO") and not self._no_restart: 305 if (soft_mode is not None and soft_mode == "AUTO") and not self._no_restart: