Skip to content

Commit 32b8041

Browse files
committed
feat: Add lifecycle hook logging for installation process
- Introduced `AgentStartLifecycle` log message to indicate the start of the lifecycle hook. - Updated log processing to consider lifecycle start as complete when rebooting or shutting down. This is mainly a UX improvement to show the user the 100% complete before the node is rebooted/shutdown Signed-off-by: Itxaka <[email protected]>
1 parent b86ee83 commit 32b8041

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

internal/agent/TUIconstants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,6 @@ const (
9191
AgentRecoveryLog = "Copying /run/cos/state/cOS/active.img source to /run/cos/recovery/cOS/recovery.img"
9292
AgentPassiveLog = "Copying /run/cos/state/cOS/active.img source to /run/cos/state/cOS/passive.img"
9393
AgentAfterInstallLog = "Running after-install hook"
94+
AgentStartLifecycle = "Running Lifecycle hook"
9495
AgentCompleteLog = "Finish Lifecycle hook" // This is the last step before completion so can make it the complete part
9596
)

internal/agent/TUIinstallProcessPage.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ func (p *installProcessPage) processLogLines(buf []byte, lastLen int, errorSent
273273
p.output <- StepPrefix + InstallPassiveStep
274274
} else if strings.Contains(msg, AgentAfterInstallLog) && !strings.Contains(msg, "chroot") {
275275
p.output <- StepPrefix + InstallAfterInstallStep
276+
} else if strings.Contains(msg, AgentStartLifecycle) && mainModel.finishAction != "nothing" {
277+
// Lifecycle start can be considered as finished if we are rebooting or shutting down as that hook
278+
// will reboot/shutdown the system and not return any log after that
279+
p.output <- StepPrefix + InstallCompleteStep
276280
} else if strings.Contains(msg, AgentCompleteLog) {
277281
p.output <- StepPrefix + InstallCompleteStep
278282
}

0 commit comments

Comments
 (0)