From 6ccd72a9b646b540467be2657f4fb9964d7a0ed9 Mon Sep 17 00:00:00 2001 From: Joseph Vazhappilly Date: Thu, 27 Nov 2025 01:43:00 -0500 Subject: [PATCH] Update hostname handling in prebootstrap deploy In prebootstrap environments, patch installation can fail when software deploy host is executed on a system with hostname other than localhost. This update modifies the software-agent to always report localhost during prebootstrap, ensuring consistency of the deploy host state in the database. Closes-Bug: 2133142 Test Plan: PASS: Change hostname in prebootstrap stage and deploy patches using software commands and ensure that patches are installed successfully PASS: Bootstrap and verify software commands for updates are working Change-Id: I04e94d7bb4e168e1835a576a5922531cae59b361 Signed-off-by: Joseph Vazhappilly --- software/software/software_agent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/software/software/software_agent.py b/software/software/software_agent.py index f85374bf..f6e89ec3 100644 --- a/software/software/software_agent.py +++ b/software/software/software_agent.py @@ -207,9 +207,13 @@ class PatchMessageHelloAgentAck(messages.PatchMessage): def encode(self): global pa messages.PatchMessage.encode(self) + if pa.pre_bootstrap: + hostname = constants.PREBOOTSTRAP_HOSTNAME + else: + hostname = socket.gethostname() self.message['query_id'] = pa.query_id self.message['out_of_date'] = pa.changes - self.message['hostname'] = socket.gethostname() + self.message['hostname'] = hostname self.message['requires_reboot'] = pa.node_is_patched self.message['patch_failed'] = pa.patch_failed self.message['sw_version'] = SW_VERSION