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
CHANGELOG
1 1 18-01-2023 (AKo): v0.6.16.1
2 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 5 16-01-2023 (AKo): v0.6.16.0
5 6 - Change redis container name to pyros-redis
6 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 59 if simulated_computer != None:
60 60 self.computer = simulated_computer
61 61 self.simulated_computer = simulated_computer
  62 + print(self.computer)
62 63 name_from_config = self.get_config().get_agent_sst_of_computer(self.computer)
63 64 if name_from_config != None:
64 65 name = name_from_config
65 66 self.name = name
66 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 69 else:
69   - self._agent_survey = AgentSurvey.objects.create(
  70 + self.__agent_survey = AgentSurvey.objects.create(
70 71 name=self.name,
71 72 validity_duration=60,
72 73 mode=self.get_mode(),
73 74 status=self.get_status(),
74 75 iteration=-1
75 76 )
  77 + print(f"FROM AGENT SST {self.__agent_survey}")
76 78 WITH_DOCKER = False
77 79 if os.environ.get("WITH_DOCKER"):
78 80 WITH_DOCKER = True
... ... @@ -296,7 +298,8 @@ class AgentSST(Agent):
296 298  
297 299 # checking status of agent if they are timeout if in auto mode
298 300 try:
299   - soft_mode = Majordome.objects.last().soft_mode
  301 + majordome = Majordome.objects.last()
  302 + soft_mode = majordome.soft_mode
300 303 except Majordome.DoesNotExist:
301 304 soft_mode = None
302 305 if (soft_mode is not None and soft_mode == "AUTO") and not self._no_restart:
... ...