From eb02d0b324740242cb23cf116c980dd4fd1ca56a Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Fri, 24 May 2024 06:46:47 -0400 Subject: [PATCH] Fixed keyring yaml write to temp file, and run certificate init through main init Signed-off-by: 1000TurquoisePogs --- bin/commands/init/certificate/index.sh | 17 +++++++++-------- bin/commands/init/index.ts | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/commands/init/certificate/index.sh b/bin/commands/init/certificate/index.sh index 9e4d12222e..46a507f48c 100644 --- a/bin/commands/init/certificate/index.sh +++ b/bin/commands/init/certificate/index.sh @@ -14,17 +14,17 @@ ############################### # validation require_zowe_yaml - -if [ -z "${ZWE_PRIVATE_TMP_MERGED_YAML_DIR}" ]; then - # user-facing command, use tmpdir to not mess up workspace permissions - export ZWE_PRIVATE_TMP_MERGED_YAML_DIR=$(create_tmp_file) - mkdir -p ${ZWE_PRIVATE_TMP_MERGED_YAML_DIR} - _CEE_RUNOPTS="XPLINK(ON),HEAPPOOLS(OFF),HEAPPOOLS64(OFF)" ${ZWE_zowe_runtimeDirectory}/bin/utils/configmgr -script "${ZWE_zowe_runtimeDirectory}/bin/commands/internal/config/output/cli.js" - # use the yaml configmgr returns because it will contain defaults for the version we are using. +if [ -n "${ZWE_PRIVATE_CONFIG_ORIG}" ]; then + CONFIG_TO_WRITE=${ZWE_PRIVATE_CONFIG_ORIG} +else CONFIG_TO_WRITE=${ZWE_CLI_PARAMETER_CONFIG} - ZWE_CLI_PARAMETER_CONFIG=${ZWE_PRIVATE_TMP_MERGED_YAML_DIR}/.zowe-merged.yaml fi +export ZWE_PRIVATE_TMP_MERGED_YAML_DIR=$(create_tmp_file) +mkdir -p ${ZWE_PRIVATE_TMP_MERGED_YAML_DIR} +_CEE_RUNOPTS="XPLINK(ON),HEAPPOOLS(OFF),HEAPPOOLS64(OFF)" ${ZWE_zowe_runtimeDirectory}/bin/utils/configmgr -script "${ZWE_zowe_runtimeDirectory}/bin/commands/internal/config/output/cli.js" +# use the yaml configmgr returns because it will contain defaults for the version we are using. +ZWE_CLI_PARAMETER_CONFIG=${ZWE_PRIVATE_TMP_MERGED_YAML_DIR}/.zowe-merged.yaml ############################### # read prefix and validate @@ -431,6 +431,7 @@ else # JCE* content print_level2_message "Certificate is generated in keyring successfully." fi + ZWE_CLI_PARAMETER_CONFIG=${CONFIG_TO_WRITE} # update zowe.yaml if [ "${ZWE_CLI_PARAMETER_UPDATE_CONFIG}" = "true" ]; then print_level1_message "Update certificate configuration to ${ZWE_CLI_PARAMETER_CONFIG}" diff --git a/bin/commands/init/index.ts b/bin/commands/init/index.ts index f2a402013b..7ceb0aacaa 100644 --- a/bin/commands/init/index.ts +++ b/bin/commands/init/index.ts @@ -114,7 +114,7 @@ export function execute(allowOverwrite?: boolean, dryRun?: boolean, ignoreSecuri initSecurity.execute(dryRun, ignoreSecurityFailures); } //initCertificate.execute(); - let result = shell.execSync('sh', '-c', `${std.getenv('ZWE_zowe_runtimeDirectory')}/bin/zwe init certificate ${dryRun?'--dry-run':''} ${updateConfig?'--update-config':''} ${allowOverwrite?'--alow-overwrite':''} ${ignoreSecurityFailures?'--ignore-security-failures':''} -c "${std.getenv('ZWE_CLI_PARAMETER_CONFIG')}"`); + let result = shell.execSync('sh', '-c', `ZWE_PRIVATE_CLI_LIBRARY_LOADED= ${std.getenv('ZWE_zowe_runtimeDirectory')}/bin/zwe init certificate ${dryRun?'--dry-run':''} ${updateConfig?'--update-config':''} ${allowOverwrite?'--allow-overwrite':''} ${ignoreSecurityFailures?'--ignore-security-failures':''} -c "${std.getenv('ZWE_CLI_PARAMETER_CONFIG')}"`); initStc.execute(allowOverwrite); common.printLevel1Message(`Zowe is configured successfully.`);