Skip to content

Commit

Permalink
Merge pull request #2088 from zowe/update-next
Browse files Browse the repository at this point in the history
Update next branch with changes from master
  • Loading branch information
t1m0thyj authored Mar 12, 2024
2 parents a4dad7c + 10c5389 commit a72e841
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/rust-cli-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
id: upload-release-asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/x86_64-unknown-linux-gnu/release/zowe-linux.tgz
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/x86_64-unknown-linux-gnu/release/zowe-linux.tgz --repo ${{ github.repository }}


build-macos:
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
id: upload-release-asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/release/zowe-macos.tgz
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/release/zowe-macos.tgz --repo ${{ github.repository }}


build-windows:
Expand Down Expand Up @@ -150,4 +150,4 @@ jobs:
id: upload-release-asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/release/zowe-windows.tgz
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/release/zowe-windows.tgz --repo ${{ github.repository }}
12 changes: 12 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Zowe CLI package will be documented in this file.

## Recent Changes

- BugFix: Fixed default base profile missing in config generated by `zowe config auto-init` [#2088](https://github.com/zowe/zowe-cli/pull/2088)

## `8.0.0-next.202403061549`

- BugFix: Update daemon dependencies for technical currency [#2077](https://github.com/zowe/zowe-cli/pull/2077)
Expand Down Expand Up @@ -83,6 +87,14 @@ LTS Breaking: Removed the following previously deprecated items: [#1981](https:/

- Major: First major version bump for V3

## `7.23.5`

- BugFix: Fixed default base profile missing in config generated by `zowe config auto-init` [#2084](https://github.com/zowe/zowe-cli/pull/2084)

## `7.23.4`

- BugFix: Updated dependencies of the daemon client for technical currency [#2076](https://github.com/zowe/zowe-cli/pull/2076)

## `7.23.3`

- BugFix: Fixed race condition in `config convert-profiles` command that may fail to delete secure values for old profiles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ function mockConfigApi(properties: IConfig | undefined): any {
},
profiles: {
getProfilePathFromName: (name: string) => `profiles.${name}`,
get: jest.fn()
get: jest.fn().mockReturnValue({})
},
secure: {
securePropsForProfile: jest.fn().mockReturnValue([])
}
},
exists: true,
Expand Down
32 changes: 24 additions & 8 deletions packages/cli/src/config/auto-init/ApimlAutoInitHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as lodash from "lodash";
import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk";
import { BaseAutoInitHandler, AbstractSession, ICommandArguments, IConfig, IConfigProfile,
ISession, IHandlerResponseApi, IHandlerParameters, SessConstants, ImperativeConfig,
ImperativeError, RestClientError, TextUtils
ImperativeError, RestClientError, TextUtils, Config
} from "@zowe/imperative";
import { IApimlProfileInfo, IAutoInitRpt, IProfileRpt, Login, Services } from "@zowe/core-for-zowe-sdk";

Expand Down Expand Up @@ -118,29 +118,32 @@ export default class ApimlAutoInitHandler extends BaseAutoInitHandler {
},
secure: []
};
profileConfig.defaults[this.mProfileType] = this.mProfileType;
activeBaseProfile = this.mProfileType;
baseProfileCreated = true;
} else {
const oldBaseProfile = this.getOldBaseProfileProps(config, activeBaseProfile);
lodash.set(profileConfig, config.api.profiles.getProfilePathFromName(activeBaseProfile), {
type: this.mProfileType,
properties: {
...config.api.profiles.get(activeBaseProfile),
...oldBaseProfile.properties,
host: session.ISession.hostname,
port: session.ISession.port,
rejectUnauthorized: session.ISession.rejectUnauthorized,
},
secure: []
secure: oldBaseProfile.secure ?? []
});
}

if (session.ISession.tokenType != null && session.ISession.tokenValue != null) {
const expandedBaseProfilePath = config.api.profiles.getProfilePathFromName(activeBaseProfile);
lodash.get(profileConfig, expandedBaseProfilePath).properties.tokenType = session.ISession.tokenType;
lodash.get(profileConfig, expandedBaseProfilePath).properties.tokenValue = session.ISession.tokenValue;
lodash.get(profileConfig, expandedBaseProfilePath).secure.push("tokenValue");
const baseProfileConfig = lodash.get(profileConfig, config.api.profiles.getProfilePathFromName(activeBaseProfile));
baseProfileConfig.properties.tokenType = session.ISession.tokenType;
baseProfileConfig.properties.tokenValue = session.ISession.tokenValue;
if (!baseProfileConfig.secure.includes("tokenValue")) {
baseProfileConfig.secure.push("tokenValue");
}
}

profileConfig.defaults[this.mProfileType] = activeBaseProfile;
this.recordProfilesFound(profileInfos);

// Report whether or not we created a base profile in this auto-init execution
Expand Down Expand Up @@ -515,4 +518,17 @@ export default class ApimlAutoInitHandler extends BaseAutoInitHandler {
}
}
}

private getOldBaseProfileProps(config: Config, baseProfileName: string): IConfigProfile {
const propsToRemove = ["user", "password", "certFile", "certKeyFile"];
const properties = config.api.profiles.get(baseProfileName);
for (const propName of propsToRemove) {
properties[propName] = undefined;
}
const secureProps = config.api.secure.securePropsForProfile(baseProfileName);
return {
properties,
secure: secureProps.filter((propName) => !propsToRemove.includes(propName))
};
}
}
2 changes: 1 addition & 1 deletion zowex/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions zowex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zowe"
version = "1.2.0"
version = "1.2.1"
authors = ["Zowe Project"]
edition = "2018"
license = "EPL-2.0"
Expand All @@ -14,7 +14,7 @@ home = "0.5.9"
is-terminal = "0.4.12"
pathsearch = "0.2.0"
rpassword = "7.3.1"
serde = { version = "1.0.197", features = ["derive"]}
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
simple-error = "0.3.0"
supports-color = "3.0.0"
Expand Down

0 comments on commit a72e841

Please sign in to comment.