diff --git a/CHANGELOG.md b/CHANGELOG.md index a24e5000b2..88cdd0a1ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to the Zowe Installer will be documented in this file. ## `3.1.0` +- Bugfix: When logging `zwe` command, sometimes the log has wrong file tag and the log is unreadable. [#4071](https://github.com/zowe/zowe-install-packaging/pull/4071) +- Bugfix: When `--log-dir` parameter for `zwe` command is a file, there might be an error "InternalError: stack overflow". [#4064](https://github.com/zowe/zowe-install-packaging/pull/4064) - Enhancement: command `zwe init` does not require NodeJS [#4088](https://github.com/zowe/zowe-install-packaging/pull/4088) - 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) diff --git a/bin/commands/init/certificate/index.sh b/bin/commands/init/certificate/index.sh index f226009c5b..90106839fb 100644 --- a/bin/commands/init/certificate/index.sh +++ b/bin/commands/init/certificate/index.sh @@ -95,13 +95,17 @@ elif [[ "${cert_type}" == JCE*KS ]]; then keyring_option=2 fi fi +# Trace or debug information will be part of the output, let's turn it off for the inline zwe commands +save_trace=$ZWE_PRIVATE_LOG_LEVEL_ZWELS +ZWE_PRIVATE_LOG_LEVEL_ZWELS= # read keystore domains -cert_import_CAs=$(read_yaml_configmgr "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.certificate.importCertificateAuthorities" | tr '\n' ',') +cert_import_CAs=$(zwecli_inline_execute_command internal config get --config "${ZWE_CLI_PARAMETER_CONFIG}" --path ".zowe.setup.certificate.importCertificateAuthorities" | tr '\n' ',' | awk '{ print substr( $0, 1, length($0)-1 ) }') # read keystore domains -cert_domains=$(read_yaml_configmgr "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.certificate.san" | tr '\n' ',') +cert_domains=$(zwecli_inline_execute_command internal config get --config "${ZWE_CLI_PARAMETER_CONFIG}" --path ".zowe.setup.certificate.san" | tr '\n' ',' | awk '{ print substr( $0, 1, length($0)-1 ) }') if [ -z "${cert_domains}" ]; then - cert_domains=$(read_yaml_configmgr "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.externalDomains" | tr '\n' ',') + cert_domains=$(zwecli_inline_execute_command internal config get --config "${ZWE_CLI_PARAMETER_CONFIG}" --path ".zowe.externalDomains" | tr '\n' ',' | awk '{ print substr( $0, 1, length($0)-1 ) }') fi +ZWE_PRIVATE_LOG_LEVEL_ZWELS=$save_trace # read z/OSMF info for item in user ca; do diff --git a/bin/libs/common.ts b/bin/libs/common.ts index ad3457926c..47bdd94dcc 100644 --- a/bin/libs/common.ts +++ b/bin/libs/common.ts @@ -128,36 +128,21 @@ export function date(...args: string[]): string|undefined { let logExists = false; -let logFile:std.File|null = null; function writeLog(message: string): boolean { + const filename = std.getenv('ZWE_PRIVATE_LOG_FILE'); + if (!filename) { + return false; + } + logExists = fs.fileExists(filename); if (!logExists) { - const filename = std.getenv('ZWE_PRIVATE_LOG_FILE'); - if (filename) { + fs.createFile(filename, 0o640, message); logExists = fs.fileExists(filename); - if (!logExists) { - fs.createFile(filename, 0o640, message); - logExists = fs.fileExists(filename); - } - if (logExists) { - let errObj = {errno:undefined}; - logFile = std.open(filename, 'w', errObj); - if (errObj.errno) { - printError(`Error opening file ${filename}, errno=${errObj.errno}`); - logFile=null; - logExists=false; - return false; - } - } - } - } - if (logFile===undefined || logFile===null) { - return false; } else { - //TODO this does utf8. should we flip it to 1047 on zos? - logFile.puts(message); - return true; + xplatform.appendFileUTF8(filename, xplatform.AUTO_DETECT, message); + return true; } + return logExists; } diff --git a/build/zwe/types/@qjstypes/xplatform.d.ts b/build/zwe/types/@qjstypes/xplatform.d.ts index f139e1ac00..6d4572936e 100644 --- a/build/zwe/types/@qjstypes/xplatform.d.ts +++ b/build/zwe/types/@qjstypes/xplatform.d.ts @@ -27,6 +27,7 @@ export function stringFromBytes(data:ArrayBuffer, offset:number, length:number, */ export function loadFileUTF8(path:string, sourceCCSID:number):string; export function storeFileUTF8(path:string, targetCCSID:number, content:string):number; +export function appendFileUTF8(path: string, targetCCSID:number, content:string):number; export var AUTO_DETECT:number; export var NO_CONVERT:number;