Island: Modify machine with AgentRegistrationData

Since the Machine is passed to other methods, it should have the most up
to date data.
This commit is contained in:
Mike Salvatore 2022-09-21 12:36:32 -04:00
parent 4101f7509a
commit 271475570d
1 changed files with 4 additions and 8 deletions

View File

@ -59,15 +59,11 @@ class handle_agent_registration:
return None
def _upsert_machine(
self, existing_machine: Machine, agent_registration_data: AgentRegistrationData
):
updated_machine = existing_machine.copy()
def _upsert_machine(self, machine: Machine, agent_registration_data: AgentRegistrationData):
self._update_hardware_id(machine, agent_registration_data)
self._update_network_interfaces(machine, agent_registration_data)
self._update_hardware_id(updated_machine, agent_registration_data)
self._update_network_interfaces(updated_machine, agent_registration_data)
self._machine_repository.upsert_machine(updated_machine)
self._machine_repository.upsert_machine(machine)
def _update_hardware_id(self, machine: Machine, agent_registration_data: AgentRegistrationData):
if (