Skip to content

Commit ae64a17

Browse files
updating to WDT 2.1.0 targets and enhancing PV behavior (#104)
* updating to WDT 2.1.0 targets and enhancing PV behavior * updating copyrights
1 parent bb1b1f0 commit ae64a17

File tree

19 files changed

+173
-56
lines changed

19 files changed

+173
-56
lines changed

electron/app/js/wdtPrepareModel.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ const _vzTargetTypeName = i18n.t('prepare-model-wko-target-type-name');
3030

3131
async function prepareModel(currentWindow, stdoutChannel, stderrChannel, prepareConfig) {
3232
const logger = getLogger();
33-
const { javaHome, oracleHome, projectDirectory, modelsSubdirectory, modelFiles, variableFiles, wdtTargetType } = prepareConfig;
33+
const { javaHome, oracleHome, projectDirectory, modelsSubdirectory, modelFiles,
34+
variableFiles, wdtTargetType, targetDomainLocation } = prepareConfig;
3435
const outputDirectory = await fsUtils.createTemporaryDirectory(projectDirectory, 'prepareModel');
3536
const absoluteModelFiles = fsUtils.getAbsolutePathsList(modelFiles, projectDirectory);
3637

3738
const argList = [
3839
'-oracle_home', oracleHome,
3940
'-model_file', absoluteModelFiles.join(','),
4041
'-output_dir', outputDirectory,
41-
'-target', wdtTargetType
42+
'-target', getToolTargetType(wdtTargetType, targetDomainLocation)
4243
];
4344

4445
const absoluteVariableFiles = fsUtils.getAbsolutePathsList(variableFiles, projectDirectory);
@@ -50,7 +51,7 @@ async function prepareModel(currentWindow, stdoutChannel, stderrChannel, prepare
5051
//
5152
const env = {
5253
JAVA_HOME: javaHome,
53-
WDT_CUSTOM_CONFIG: getWdtCustomConfigDirectory(prepareConfig)
54+
WDT_CUSTOM_CONFIG: getWdtCustomConfigDirectory()
5455
};
5556
getLogger().debug(`Invoking ${getPrepareModelShellScript()} with args ${JSON.stringify(argList)} and environment ${JSON.stringify(env)}`);
5657

@@ -75,7 +76,7 @@ async function prepareModel(currentWindow, stdoutChannel, stderrChannel, prepare
7576
}
7677
} catch (err) {
7778
results.isSuccess = false;
78-
results.reason = i18n.t('prepare-model-execution-failed-error-message', { error: getErrorMessage(err) });
79+
results.reason = i18n.t('prepare-model-execution-failed-error-message', { error: errorUtils.getErrorMessage(err) });
7980
results.error = err;
8081
logger.error(results.reason);
8182
removeTempDirectory(outputDirectory).then().catch();
@@ -114,7 +115,7 @@ async function prepareModel(currentWindow, stdoutChannel, stderrChannel, prepare
114115
await getModelFileContent(currentWindow, updatedModelFiles, updatedVariableFiles, []);
115116
} catch (err) {
116117
results.isSuccess = false;
117-
results.reason = i18n.t('prepare-model-move-files-failed-error-message', { error: getErrorMessage(err) });
118+
results.reason = i18n.t('prepare-model-move-files-failed-error-message', { error: errorUtils.getErrorMessage(err) });
118119
results.error = err;
119120
logger.error(results.reason);
120121
removeTempDirectory(outputDirectory).then().catch();
@@ -128,7 +129,7 @@ async function prepareModel(currentWindow, stdoutChannel, stderrChannel, prepare
128129
results['secrets'] = await getJsonSecretsContent(outputDirectory);
129130
} catch (err) {
130131
results.isSuccess = false;
131-
results.reason = getErrorMessage(err);
132+
results.reason = errorUtils.getErrorMessage(err);
132133
results.error = err;
133134
logger.error(results.reason);
134135
removeTempDirectory(outputDirectory).then().catch();
@@ -139,7 +140,7 @@ async function prepareModel(currentWindow, stdoutChannel, stderrChannel, prepare
139140
results['domain'] = await getTargetSpecContent(wdtTargetType, outputDirectory);
140141
} catch (err) {
141142
results.isSuccess = false;
142-
results.reason = getErrorMessage(err);
143+
results.reason = errorUtils.getErrorMessage(err);
143144
results.error = err;
144145
logger.error(results.reason);
145146
removeTempDirectory(outputDirectory).then().catch();
@@ -167,18 +168,6 @@ async function prepareModel(currentWindow, stdoutChannel, stderrChannel, prepare
167168
return Promise.resolve(results);
168169
}
169170

170-
function getErrorMessage(err) {
171-
let errorMessage;
172-
if (!err) {
173-
errorMessage = 'Unknown Error';
174-
} else if (!err.message) {
175-
errorMessage = err.toString();
176-
} else {
177-
errorMessage = err.message;
178-
}
179-
return errorMessage;
180-
}
181-
182171
async function removeTempDirectory(outputDirectory) {
183172
return new Promise(resolve => {
184173
if (_deleteTempDirectory) {
@@ -438,6 +427,11 @@ async function getVzSpecContent(outputDirectory) {
438427
});
439428
}
440429

430+
function getToolTargetType(wdtTargetType, targetDomainLocation) {
431+
const suffix = targetDomainLocation === 'mii' ? '' : `-${targetDomainLocation}`;
432+
return `${wdtTargetType}${suffix}`;
433+
}
434+
441435
function getFileExistsErrorMessage(targetType, fileName, err) {
442436
const error = new Error(i18n.t('prepare-model-spec-file-exists-error-message',
443437
{ targetType: targetType, fileName: fileName, error: errorUtils.getErrorMessage(err) }));

electron/app/js/wdtValidateModel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function validateModel(currentWindow, stdoutChannel, stderrChannel, valida
4242

4343
const env = {
4444
JAVA_HOME: javaHome,
45-
WDT_CUSTOM_CONFIG: getWdtCustomConfigDirectory(validateConfig)
45+
WDT_CUSTOM_CONFIG: getWdtCustomConfigDirectory()
4646
};
4747
getLogger().debug(`Invoking ${getValidateModelShellScript()} with args ${JSON.stringify(argList)} and environment ${JSON.stringify(env)}`);
4848

electron/app/js/wktTools.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ function getValidateModelShellScript() {
4545
return path.join(getWdtDirectory(), 'bin', 'validateModel' + scriptExtension);
4646
}
4747

48-
function getWdtCustomConfigDirectory(config) {
49-
const targetDomainLocation = config.targetDomainLocation || 'mii';
50-
return path.join(getToolsDirectory(), 'wdt-config', targetDomainLocation);
48+
function getWdtCustomConfigDirectory() {
49+
return path.join(getToolsDirectory(), 'wdt-config');
5150
}
5251

5352
function isWdtErrorExitCode(exitCode) {

electron/app/locales/en/webui.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@
530530
"domain-design-aux-image-registry-pull-email-help": "The image registry user's email address used to create the Kubernetes image pull secret for the auxiliary image.",
531531

532532
"domain-design-clusters-title": "Clusters",
533+
"domain-design-clusters-table-aria-label": "Clusters configuration table",
533534
"domain-design-no-clusters-message": "No clusters found for this domain. If your project has a model that defines clusters, please run Prepare Model to populate the clusters tables.",
534535
"domain-design-clusters-name-heading": "Cluster Name",
535536
"domain-design-clusters-replicas-heading": "Replicas",
@@ -539,6 +540,8 @@
539540
"domain-design-clusters-memory-request-heading": "Kubernetes Memory Request",
540541
"domain-design-edit-cluster-label": "Edit Cluster Settings",
541542
"domain-design-cluster-dialog-title": "Edit Cluster Settings",
543+
"domain-design-add-cluster-label": "Add Cluster",
544+
"domain-design-delete-cluster-label": "Delete Cluster",
542545

543546
"domain-design-get-domain-status": "Get Domain Status",
544547
"domain-design-domain-status-label": "Domain Status: ",
@@ -559,6 +562,8 @@
559562

560563
"domain-design-cluster-name-label": "Cluster Name",
561564
"domain-design-cluster-name-help": "The cluster name in the domain for which to enter settings.",
565+
"domain-design-cluster-name-is-empty-error": "Cluster Name cannot be empty",
566+
"domain-design-cluster-name-not-unique-error": "{{name}} is already present in cluster list [{{existingNames}}]",
562567
"domain-design-cluster-replicas-label": "Replicas",
563568
"domain-design-cluster-replicas-help": "The number of managed servers to start for the cluster.",
564569
"domain-design-cluster-min-heap-label": "Minimum Heap Size",
@@ -852,7 +857,6 @@
852857
"wdt-discoverer-online-discovery-failed-error-prefix": "Unable to discover domain {{adminUrl}} in online mode",
853858

854859
"wdt-validator-aborted-error-title": "Validate Model Aborted",
855-
"wdt-validator-domain-in-pv-message": "Validate Model has no meaning when the target domain location is an externally created Kubernetes persistent volume.",
856860
"wdt-validator-invalid-java-home-error-prefix": "Unable to validate model due to the Java Home being invalid",
857861
"wdt-validator-invalid-oracle-home-error-prefix": "Unable to validate model due to the Oracle Home being invalid",
858862
"wdt-validator-project-not-saved-error-prefix": "Unable to validate model because project save failed",
@@ -868,7 +872,6 @@
868872
"wdt-validator-validate-complete-message": "Validate Model successfully validated the model.",
869873

870874
"wdt-preparer-aborted-error-title": "Prepare Model Aborted",
871-
"wdt-preparer-domain-in-pv-message": "Prepare Model has no meaning when the target domain location is an externally created Kubernetes persistent volume.",
872875
"wdt-preparer-invalid-java-home-error-prefix": "Unable to prepare model due to the Java Home being invalid",
873876
"wdt-preparer-invalid-oracle-home-error-prefix": "Unable to prepare model due to the Oracle Home being invalid",
874877
"wdt-preparer-project-not-saved-error-prefix": "Unable to prepare model because project save failed",
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"model_filters" : {
33
"discover": [
4-
{ "name": "vz_prep", "path": "@@TARGET_CONFIG_DIR@@/vz_filter.py" },
54
{ "id": "wko_filter" }
65
]
76
},
@@ -10,6 +9,5 @@
109
"credentials_output_method" : "script",
1110
"exclude_domain_bin_contents": true,
1211
"wls_credentials_name" : "__weblogic-credentials__",
13-
"additional_secrets": "runtime-encryption-secret",
1412
"additional_output" : "vz-application.yaml"
1513
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"model_filters" : {
3+
"discover": [
4+
{ "id": "wko_filter" }
5+
]
6+
},
7+
"variable_injectors" : {"PORT": {},"HOST": {},"URL": {}},
8+
"validation_method" : "lax",
9+
"credentials_output_method" : "script",
10+
"exclude_domain_bin_contents": true,
11+
"wls_credentials_name" : "__weblogic-credentials__",
12+
"additional_output" : "vz-application.yaml",
13+
"use_persistent_volume" : true
14+
}

tools/wdt-config/mii/targets/vz/target.json renamed to tools/wdt-config/targets/vz/target.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"model_filters" : {
33
"discover": [
4-
{ "name": "vz_prep", "path": "@@TARGET_CONFIG_DIR@@/vz_filter.py" },
54
{ "id": "wko_filter" }
65
]
76
},
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"model_filters" : {
33
"discover": [
4-
{ "name": "wko_prep", "path": "@@TARGET_CONFIG_DIR@@/wko_operator_filter.py" },
54
{ "id": "wko_filter" }
65
]
76
},
@@ -10,6 +9,5 @@
109
"credentials_output_method" : "json",
1110
"exclude_domain_bin_contents": true,
1211
"wls_credentials_name" : "__weblogic-credentials__",
13-
"additional_secrets": "runtime-encryption-secret",
1412
"additional_output" : "wko-domain.yaml"
1513
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"model_filters" : {
3+
"discover": [
4+
{ "id": "wko_filter" }
5+
]
6+
},
7+
"variable_injectors" : {"PORT": {},"HOST": {},"URL": {}},
8+
"validation_method" : "wktui",
9+
"credentials_output_method" : "json",
10+
"exclude_domain_bin_contents": true,
11+
"wls_credentials_name" : "__weblogic-credentials__",
12+
"additional_output" : "wko-domain.yaml",
13+
"use_persistent_volume" : true
14+
}

tools/wdt-config/mii/targets/wko/target.json renamed to tools/wdt-config/targets/wko/target.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"model_filters" : {
33
"discover": [
4-
{ "name": "wko_prep", "path": "@@TARGET_CONFIG_DIR@@/wko_operator_filter.py" },
54
{ "id": "wko_filter" }
65
]
76
},

0 commit comments

Comments
 (0)