From b27046816c4ee23a550e47c2866df3e731d2807f Mon Sep 17 00:00:00 2001 From: Martin Zeithaml Date: Tue, 3 Sep 2024 14:55:32 +0200 Subject: [PATCH 1/2] zOSMF validate Signed-off-by: Martin Zeithaml --- CHANGELOG.md | 3 +++ bin/commands/internal/start/prepare/index.sh | 7 +++++-- bin/commands/internal/start/prepare/index.ts | 13 ++++++------- bin/libs/zosmf.sh | 13 ------------- bin/libs/zosmf.ts | 11 ----------- 5 files changed, 14 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6485176d2f..ef40d52ac9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to the Zowe Installer will be documented in this file. +## `2.18.1` +- Bugfix: Error message `ZWEL0141E` did not print user ID + ## `2.17.0` ## New features and enhancements diff --git a/bin/commands/internal/start/prepare/index.sh b/bin/commands/internal/start/prepare/index.sh index 85ca4ad100..464ae53205 100644 --- a/bin/commands/internal/start/prepare/index.sh +++ b/bin/commands/internal/start/prepare/index.sh @@ -142,8 +142,11 @@ global_validate() { if [[ ${ZWE_ENABLED_COMPONENTS} == *"discovery"* || ${ZWE_ENABLED_COMPONENTS} == *"files-api"* || ${ZWE_ENABLED_COMPONENTS} == *"jobs-api"* ]]; then validate_this "validate_zosmf_host_and_port \"${ZOSMF_HOST}\" \"${ZOSMF_PORT}\" 2>&1" "zwe-internal-start-prepare,global_validate:${LINENO}" fi - elif [ "${ZWE_components_gateway_apiml_security_auth_provider}" = "zosmf" ]; then - validate_this "validate_zosmf_as_auth_provider \"${ZOSMF_HOST}\" \"${ZOSMF_PORT}\" \"${ZWE_components_gateway_apiml_security_auth_provider}\" 2>&1" "zwe-internal-start-prepare,global_validate:${LINENO}" + if [ "${ZWE_components_discovery_enabled}" = "false" -a "${ZWE_components_gateway_apiml_security_auth_provider}" = "zosmf" ]; then + let "ZWE_PRIVATE_ERRORS_FOUND=${ZWE_PRIVATE_OLD_ERRORS_FOUND}+1" + print_error "Using z/OSMF as 'components.gateway.apiml.security.auth.provider' is not possible: discovery is disabled." + print_formatted_info "ZWELS" "zwe-internal-start-prepare,global_validate:${LINENO}" "Zosmf validation failed" + fi fi check_runtime_validation_result "zwe-internal-start-prepare,global_validate:${LINENO}" diff --git a/bin/commands/internal/start/prepare/index.ts b/bin/commands/internal/start/prepare/index.ts index cf9463fbdc..30c67135f2 100644 --- a/bin/commands/internal/start/prepare/index.ts +++ b/bin/commands/internal/start/prepare/index.ts @@ -75,7 +75,7 @@ function prepareLogDirectory() { if (logDir) { os.mkdir(logDir, 0o750); if (!fs.isDirectoryWritable(logDir)) { - common.printFormattedError("ZWELS", "zwe-internal-start-prepare,prepare_log_directory", `ZWEL0141E: User $(get_user_id) does not have write permission on ${logDir}.`); + common.printFormattedError("ZWELS", "zwe-internal-start-prepare,prepare_log_directory", `ZWEL0141E: User ${user} does not have write permission on ${logDir}.`); std.exit(141); } } @@ -172,12 +172,11 @@ function globalValidate(enabledComponents:string[]): void { privateErrors++; common.printFormattedError('ZWELS', "zwe-internal-start-prepare,global_validate", "Zosmf validation failed"); } - } else if (std.getenv('ZWE_components_gateway_apiml_security_auth_provider') == "zosmf") { - let zosmfOk = zosmf.validateZosmfAsAuthProvider(zosmfHost, zosmfPort, 'zosmf'); - if (!zosmfOk) { - privateErrors++; - common.printFormattedError('ZWELS', "zwe-internal-start-prepare,global_validate", "Zosmf validation failed"); - } + } + if (!enabledComponents.includes('discovery') && std.getenv('ZWE_components_gateway_apiml_security_auth_provider') == "zosmf") { + privateErrors++; + common.printError("Using z/OSMF as 'components.gateway.apiml.security.auth.provider' is not possible: discovery is disabled."); + common.printFormattedError('ZWELS', "zwe-internal-start-prepare,global_validate", "Zosmf validation failed"); } } diff --git a/bin/libs/zosmf.sh b/bin/libs/zosmf.sh index 116f66c65e..84477c3699 100644 --- a/bin/libs/zosmf.sh +++ b/bin/libs/zosmf.sh @@ -49,16 +49,3 @@ validate_zosmf_host_and_port() { print_message "Successfully checked z/OS MF is available on 'https://${zosmf_host}:${zosmf_port}/zosmf/info'" fi } - -validate_zosmf_as_auth_provider() { - zosmf_host="${1}" - zosmf_port="${2}" - auth_provider="${3}" - - if [ -n "${zosmf_host}" -a -n "${zosmf_port}" ]; then - if [ "${auth_provider}" = "zosmf" ]; then - print_error "z/OSMF is not configured. Using z/OSMF as authentication provider is not supported." - return 1 - fi - fi -} diff --git a/bin/libs/zosmf.ts b/bin/libs/zosmf.ts index 949c0eddf6..9e05a98be0 100644 --- a/bin/libs/zosmf.ts +++ b/bin/libs/zosmf.ts @@ -47,14 +47,3 @@ export function validateZosmfHostAndPort(zosmfHost: string, zosmfPort: number): } return zosmfCheckPassed; } - -//TODO isnt this completely backwards? -export function validateZosmfAsAuthProvider(zosmfHost: string, zosmfPort: number, authProvider: string): boolean { - if (zosmfHost && zosmfPort) { - if (authProvider == 'zosmf') { - common.printError("z/OSMF is not configured. Using z/OSMF as authentication provider is not supported."); - return true; - } - } - return false; -} From 47d812105dca24501bd509f8f95a3e348307edc5 Mon Sep 17 00:00:00 2001 From: Martin Zeithaml Date: Tue, 3 Sep 2024 15:07:34 +0200 Subject: [PATCH 2/2] PR number Signed-off-by: Martin Zeithaml --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef40d52ac9..262fe86796 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to the Zowe Installer will be documented in this file. ## `2.18.1` -- Bugfix: Error message `ZWEL0141E` did not print user ID +- Bugfix: Error message `ZWEL0141E` did not print user ID. [#3971](https://github.com/zowe/zowe-install-packaging/pull/3971) ## `2.17.0`