diff --git a/CHANGELOG.md b/CHANGELOG.md index b909772b9f..3f8be7b246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to the Zowe Installer will be documented in this file. ## `3.0.1` -- Bugfix: When `--log-dir` parameter for `zwe` command is a file, there might be an error "InternalError: stack overflow". [#40nn](https://github.com/zowe/zowe-install-packaging/pull/40nn) +- Enhancement: command `zwe install` does not require NodeJS [#4069](https://github.com/zowe/zowe-install-packaging/pull/4069) - Enhancement: new javascript funtion `getStatvfs()` to obtain information about the file sysytem [#3994](https://github.com/zowe/zowe-install-packaging/pull/3994) - Enhancement: command `zwe diagnose` in javascript only [#4061](https://github.com/zowe/zowe-install-packaging/pull/4061) - Enhancement: schema validation update for `zowe.job.name` and `zowe.job.prefix` [#4060](https://github.com/zowe/zowe-install-packaging/pull/4060) diff --git a/bin/commands/install/index.sh b/bin/commands/install/index.sh index 0fc9e7fad6..05a0455e6d 100644 --- a/bin/commands/install/index.sh +++ b/bin/commands/install/index.sh @@ -26,10 +26,10 @@ ${ZWE_PRIVATE_DS_SZWEEXEC}|Zowe executable utilities library|dsntype(library) ds if [ -n "${ZWE_CLI_PARAMETER_DATASET_PREFIX}" ]; then prefix="${ZWE_CLI_PARAMETER_DATASET_PREFIX}" else - require_zowe_yaml + require_zowe_yaml "skipnode" # read prefix and validate - prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") + prefix=$(read_yaml_configmgr "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") if [ -z "${prefix}" ]; then print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157 fi diff --git a/bin/libs/common.sh b/bin/libs/common.sh index 5db74cc256..52815dfe6a 100644 --- a/bin/libs/common.sh +++ b/bin/libs/common.sh @@ -46,9 +46,9 @@ check_configmgr_enabled() { } require_zowe_yaml() { - # node is required to read yaml file - require_node - + if [ -z "${1}" ]; then + require_node + fi if [ -z "${ZWE_CLI_PARAMETER_CONFIG}" ]; then print_error_and_exit "Error ZWEL0108E: Zowe YAML config file is required." "" 108 elif [ ! -f "${ZWE_CLI_PARAMETER_CONFIG}" ]; then diff --git a/bin/libs/json.sh b/bin/libs/json.sh index 5b5342a4a3..322361c3dc 100644 --- a/bin/libs/json.sh +++ b/bin/libs/json.sh @@ -109,6 +109,40 @@ read_yaml() { return ${code} } +read_yaml_configmgr() { + file="${1}" + key=$(echo "${2}" | tr '.' '/') + ignore_null="${3:-true}" + + print_trace "- read_yaml_configmgr process ${file} and extract '${2} -> ${key}'" + + configmgr="${ZWE_zowe_runtimeDirectory}/bin/utils/configmgr" + schema="${ZWE_zowe_runtimeDirectory}/schemas/server-common.json:${ZWE_zowe_runtimeDirectory}/schemas/zowe-yaml-schema.json" + + result=$(_CEE_RUNOPTS="XPLINK(ON)" "${configmgr}" -s "$schema" -p "FILE(${file})" extract "${key}" 2>&1); + code=$? + + # When the item is not defined in config, configmgr returns + # code 0 and + # stdout = "error not found, reason=nnn" + if [[ "${result}" == "error not found, reason="* ]]; then + result="" + fi + + print_trace " * Exit code: ${code}" + print_trace " * Output:" + print_trace "$(padding_left "${result}" " ")" + + if [ ${code} -eq 0 ]; then + if [ "${ignore_null}" = "true" ]; then + if [ "${result}" = "null" -o "${result}" = "undefined" ]; then + result= + fi + fi + printf "${result}" + fi +} + read_json() { file="${1}" key="${2}"