Skip to content

Commit

Permalink
Show vm image error message upon each retry failure (#973)
Browse files Browse the repository at this point in the history
show vm image retry failure message in vmimage and upgrade cr
  • Loading branch information
brandboat authored Aug 28, 2024
1 parent a400046 commit b21b351
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 b21b351

Please sign in to comment.