Skip to content

Commit a49016c

Browse files
changing the error message from Check Verrazzano Install Status to be more helpful (#165)
1 parent a59a1b6 commit a49016c

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

electron/app/js/kubectlUtils.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,8 @@ async function verifyVerrazzanoPlatformOperatorRollout(kubectlExe, options) {
843843
});
844844
}
845845

846-
async function getVerrazzanoInstallationObject(kubectlExe, kubectlOptions, vzInstallName) {
847-
const getArgs = [ 'get', 'Verrazzano', vzInstallName, '--output=json' ];
846+
async function getVerrazzanoInstallationObject(kubectlExe, kubectlOptions) {
847+
const getArgs = [ 'get', 'Verrazzano', '--output=json' ];
848848
const httpsProxyUrl = getHttpsProxyUrl();
849849
const bypassProxyHosts = getBypassProxyHosts();
850850

@@ -856,8 +856,12 @@ async function getVerrazzanoInstallationObject(kubectlExe, kubectlOptions, vzIns
856856

857857
return new Promise(resolve => {
858858
executeFileCommand(kubectlExe, getArgs, env).then(vzJson => {
859-
result.isSuccess = true;
860-
result.payload = JSON.parse(vzJson);
859+
const vzObjectList = JSON.parse(vzJson).items;
860+
if (vzObjectList.length > 0) {
861+
const vzObject = vzObjectList[0];
862+
result.isSuccess = true;
863+
result.payload = vzObject;
864+
}
861865
resolve(result);
862866
}).catch(err => {
863867
result.reason = getErrorMessage(err);

electron/app/js/vzInstaller.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,41 @@ async function verifyVerrazzanoInstallStatus(kubectlExe, k8sOptions, vzOptions)
7979
};
8080

8181
return new Promise(resolve => {
82-
kubectlUtils.getVerrazzanoInstallationObject(kubectlExe, k8sOptions, vzOptions.name).then(result => {
82+
kubectlUtils.getVerrazzanoInstallationObject(kubectlExe, k8sOptions).then(result => {
8383
if (!result.isSuccess) {
8484
status.isSuccess = false;
85-
status.reason = i18n.t('vz-installer-check-install-status-failed-error-message', { name: vzOptions.name, error: result.reason });
85+
86+
// Two possible cases:
87+
// 1. Verrazzano CRD is not installed
88+
// 2. Some lower-level error in finding the Verrazzano object
89+
//
90+
if (_isVerrazzanoDefinitionNotFound(result.reason)) {
91+
status.reason = i18n.t('vz-installer-check-install-status-no-resource-error-message');
92+
} else {
93+
status.reason = i18n.t('vz-installer-check-install-status-failed-error-message', { name: vzOptions.name, error: result.reason });
94+
}
8695
} else {
96+
// Two possible scenarios:
97+
// 1. Verrazzano installed but under a different name (this is a failure condition).
98+
// 2. Verrazzano installed with the same name.
99+
//
100+
const vzObject = result.payload;
87101
_getStatusFromConditions(result.payload, status);
102+
if (vzOptions.name !== vzObject.metadata?.name) {
103+
status.isSuccess = false;
104+
status.reason = i18n.t('vz-installer-check-install-status-mismatched-names-error-message',
105+
{ name: vzObject.metadata?.name, version: status.version });
106+
}
88107
}
89-
90108
resolve(status);
91109
});
92110
});
93111
}
94112

113+
function _isVerrazzanoDefinitionNotFound(vzErrorMessage) {
114+
return vzErrorMessage.includes('server doesn\'t have a resource type "verrazzano"');
115+
}
116+
95117
function _getStatusFromConditions(vzObject, status) {
96118
const version = vzObject.status?.version;
97119
const conditions = vzObject.status?.conditions || [];

electron/app/locales/en/electron.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,9 @@
403403
"project-save-model-files-error-message": "Failed to save one of the WebLogic Deploy Tooling model files associated with the project: {{error}}",
404404

405405
"vz-installer-operator-not-ready-error-message": "Cannot proceed with Verrazzano installation because the Verrazzano Platform Operator is not ready: {{error}}",
406+
"vz-installer-check-install-status-no-resource-error-message": "No Verrazzano installation exists",
406407
"vz-installer-check-install-status-failed-error-message": "Cannot proceed with Verrazzano install status check for {{name}} because of an error: {{error}}",
408+
"vz-installer-check-install-status-mismatched-names-error-message": "Verrazzano {{version}} is installed under the name {{name}}",
407409

408410
"wrc-home-error-title": "Invalid WebLogic Remote Console Location",
409411
"wrc-init-error-title": "Initializing WebLogic Remote Console Backend Failed",

0 commit comments

Comments
 (0)