Skip to content

Commit

Permalink
Fixed keyring yaml write to temp file, and run certificate init throu…
Browse files Browse the repository at this point in the history
…gh main init

Signed-off-by: 1000TurquoisePogs <[email protected]>
  • Loading branch information
1000TurquoisePogs committed May 24, 2024
1 parent 88eebe0 commit eb02d0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions bin/commands/init/certificate/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
Expand Down

0 comments on commit eb02d0b

Please sign in to comment.