From 0cce0f406fe7d7aaa8ba9ecfa75d504fd3dbe728 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2024 14:29:03 +0800 Subject: [PATCH] Show vm image error message upon each retry failure (#973) (#1119) show vm image retry failure message in vmimage and upgrade cr (cherry picked from commit b21b3516bd3d66769a6c945dfe1e7e055c5cc4e5) Co-authored-by: Kuan-Po Tseng --- pkg/harvester/models/harvesterhci.io.upgrade.js | 4 ++-- pkg/harvester/models/harvesterhci.io.virtualmachineimage.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/harvester/models/harvesterhci.io.upgrade.js b/pkg/harvester/models/harvesterhci.io.upgrade.js index 8ab2589fef8..62235e0b93e 100644 --- a/pkg/harvester/models/harvesterhci.io.upgrade.js +++ b/pkg/harvester/models/harvesterhci.io.upgrade.js @@ -121,10 +121,10 @@ export default class HciUpgrade extends HarvesterResource { get upgradeImageMessage() { const conditions = this?.status?.conditions || []; const imageReady = conditions.find( cond => cond.type === 'ImageReady'); - const hasError = imageReady?.status === 'False'; + const success = imageReady?.status === 'True'; const message = imageReady?.message || imageReady?.reason; - return hasError ? message : ''; + return success ? '' : message; } get nodeUpgradeMessage() { diff --git a/pkg/harvester/models/harvesterhci.io.virtualmachineimage.js b/pkg/harvester/models/harvesterhci.io.virtualmachineimage.js index 704504efb47..6d5db182fcd 100644 --- a/pkg/harvester/models/harvesterhci.io.virtualmachineimage.js +++ b/pkg/harvester/models/harvesterhci.io.virtualmachineimage.js @@ -136,7 +136,8 @@ export default class HciVmImage extends HarvesterResource { const conditions = this?.status?.conditions || []; const initialized = conditions.find( cond => cond.type === 'Initialized'); const imported = conditions.find( cond => cond.type === 'Imported'); - const message = initialized?.message || imported?.message; + const retryLimitExceeded = conditions.find( cond => cond.type === 'RetryLimitExceeded'); + const message = initialized?.message || imported?.message || retryLimitExceeded?.message; return ucFirst(message); }