-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Labels
bugSomething isn't workingSomething isn't workingpriority-mediumNot functioning - next quarter if capacity permitsNot functioning - next quarter if capacity permitsseverity-mediumBug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.
Description
Describe the bug
Given a sample environment with ONLY a global user and global team config where the global user has a default base profile. Merged arguments misbehave when reading the merged properties inside of a profile of the global team config.
Example: Global User Configuration
{
"$schema": "./zowe.schema.json",
"profiles": {
"global_user": {
"type": "base",
"properties": {
"rejectUnauthorized": false,
"user": "user",
"password": "pass",
"account": "10000000",
"port": 333
}
}
},
"defaults": {
"base": "global_user"
},
"autoStore": true
}Example: Global Team Configuration
{
"$schema": "./zowe.schema.json",
"profiles": {
"global_team": {
"type": "base",
"properties": {}
}
},
"defaults": {
"base": ""
},
"autoStore": true
}Run the the merged arguments script with only the two configuration files defined.
npx ts-node script.ts global_team to get the merged arguments from the global_team profile
Merged Arguments Script
import { ProfileCredentials, ProfileInfo } from "@zowe/imperative";
async function debugMergedProperties() {
const profInfo = new ProfileInfo("zowe", {
overrideWithEnv: false,
credMgrOverride: ProfileCredentials.defaultCredMgrWithKeytar(() => {
return require("@zowe/secrets-for-zowe-sdk").keyring;
}),
});
const profileNameInput = process.argv[2];
const projectDir = __dirname;
await profInfo.readProfilesFromDisk({ projectDir });
const teamConfig = profInfo.getTeamConfig();
const allProfiles = profInfo.getAllProfiles();
const globalBaseProfile = allProfiles.find((prof) => prof.profName === profileNameInput);
teamConfig.api.layers.activate(false, true);
let mergedArgs;
try {
mergedArgs = profInfo.mergeArgsForProfile(globalBaseProfile!, { getSecureVals: true });
} catch (error) {
console.error("Error calling mergeArgsForProfile:", error);
return;
}
console.log("=== Merged Args (knownArgs) ===\n");
if (mergedArgs.knownArgs) {
mergedArgs.knownArgs.forEach((arg: any) => {
console.log(`${arg.argName}:`);
console.log(` dataType: ${arg.dataType}`);
console.log(` argValue: ${JSON.stringify(arg.argValue)}`);
console.log(` secure: ${arg.secure}`);
if (arg.argLoc) {
console.log(` jsonLoc: ${arg.argLoc.jsonLoc}`);
console.log(` osLoc: ${arg.argLoc.osLoc?.join(", ")}`);
}
console.log();
});
}
}
debugMergedProperties().catch((error) => {
console.error("Fatal error:", error);
process.exit(1);
});Expected and actual results
Actual Results:
- account property is missing
- port value is undefined
- user and password are marked as secure even though the source is plaintext
- rejectUnauthorized is true instead of false
Describe your environment
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpriority-mediumNot functioning - next quarter if capacity permitsNot functioning - next quarter if capacity permitsseverity-mediumBug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.
Type
Projects
Status
Medium Priority