Skip to content

Commit

Permalink
Show vm image error message upon each retry failure (#973) (#1119)
Browse files Browse the repository at this point in the history
show vm image retry failure message in vmimage and upgrade cr

(cherry picked from commit b21b351)

Co-authored-by: Kuan-Po Tseng <[email protected]>
  • Loading branch information
mergify[bot] and brandboat committed Aug 30, 2024
1 parent df5c9d2 commit 0cce0f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/harvester/models/harvesterhci.io.upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion pkg/harvester/models/harvesterhci.io.virtualmachineimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 0cce0f4

Please sign in to comment.