Skip to content

changing the error message from Check Verrazzano Install Status to be more helpful #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions electron/app/js/kubectlUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,8 +843,8 @@ async function verifyVerrazzanoPlatformOperatorRollout(kubectlExe, options) {
});
}

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

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

return new Promise(resolve => {
executeFileCommand(kubectlExe, getArgs, env).then(vzJson => {
result.isSuccess = true;
result.payload = JSON.parse(vzJson);
const vzObjectList = JSON.parse(vzJson).items;
if (vzObjectList.length > 0) {
const vzObject = vzObjectList[0];
result.isSuccess = true;
result.payload = vzObject;
}
resolve(result);
}).catch(err => {
result.reason = getErrorMessage(err);
Expand Down
28 changes: 25 additions & 3 deletions electron/app/js/vzInstaller.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,41 @@ async function verifyVerrazzanoInstallStatus(kubectlExe, k8sOptions, vzOptions)
};

return new Promise(resolve => {
kubectlUtils.getVerrazzanoInstallationObject(kubectlExe, k8sOptions, vzOptions.name).then(result => {
kubectlUtils.getVerrazzanoInstallationObject(kubectlExe, k8sOptions).then(result => {
if (!result.isSuccess) {
status.isSuccess = false;
status.reason = i18n.t('vz-installer-check-install-status-failed-error-message', { name: vzOptions.name, error: result.reason });

// Two possible cases:
// 1. Verrazzano CRD is not installed
// 2. Some lower-level error in finding the Verrazzano object
//
if (_isVerrazzanoDefinitionNotFound(result.reason)) {
status.reason = i18n.t('vz-installer-check-install-status-no-resource-error-message');
} else {
status.reason = i18n.t('vz-installer-check-install-status-failed-error-message', { name: vzOptions.name, error: result.reason });
}
} else {
// Two possible scenarios:
// 1. Verrazzano installed but under a different name (this is a failure condition).
// 2. Verrazzano installed with the same name.
//
const vzObject = result.payload;
_getStatusFromConditions(result.payload, status);
if (vzOptions.name !== vzObject.metadata?.name) {
status.isSuccess = false;
status.reason = i18n.t('vz-installer-check-install-status-mismatched-names-error-message',
{ name: vzObject.metadata?.name, version: status.version });
}
}

resolve(status);
});
});
}

function _isVerrazzanoDefinitionNotFound(vzErrorMessage) {
return vzErrorMessage.includes('server doesn\'t have a resource type "verrazzano"');
}

function _getStatusFromConditions(vzObject, status) {
const version = vzObject.status?.version;
const conditions = vzObject.status?.conditions || [];
Expand Down
2 changes: 2 additions & 0 deletions electron/app/locales/en/electron.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@
"project-save-model-files-error-message": "Failed to save one of the WebLogic Deploy Tooling model files associated with the project: {{error}}",

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

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