diff --git a/.github/workflows/rust-cli-publish.yml b/.github/workflows/rust-cli-publish.yml index 5d001c3fa6..ec7325b6da 100644 --- a/.github/workflows/rust-cli-publish.yml +++ b/.github/workflows/rust-cli-publish.yml @@ -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: @@ -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: @@ -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 }} diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index c889976875..6696374875 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -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) @@ -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 diff --git a/packages/cli/__tests__/config/auto-init/__unit__/ApimlAutoInitHandler.unit.test.ts b/packages/cli/__tests__/config/auto-init/__unit__/ApimlAutoInitHandler.unit.test.ts index e6678114d8..eaf064effa 100644 --- a/packages/cli/__tests__/config/auto-init/__unit__/ApimlAutoInitHandler.unit.test.ts +++ b/packages/cli/__tests__/config/auto-init/__unit__/ApimlAutoInitHandler.unit.test.ts @@ -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, diff --git a/packages/cli/src/config/auto-init/ApimlAutoInitHandler.ts b/packages/cli/src/config/auto-init/ApimlAutoInitHandler.ts index 399557c85a..7192b93e80 100644 --- a/packages/cli/src/config/auto-init/ApimlAutoInitHandler.ts +++ b/packages/cli/src/config/auto-init/ApimlAutoInitHandler.ts @@ -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"; @@ -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 @@ -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)) + }; + } } diff --git a/zowex/Cargo.lock b/zowex/Cargo.lock index 2fbca56114..4e1abf12f8 100644 --- a/zowex/Cargo.lock +++ b/zowex/Cargo.lock @@ -830,7 +830,7 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zowe" -version = "1.2.0" +version = "1.2.1" dependencies = [ "base64", "fslock", diff --git a/zowex/Cargo.toml b/zowex/Cargo.toml index f076e7c08e..3037c1cdcf 100644 --- a/zowex/Cargo.toml +++ b/zowex/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zowe" -version = "1.2.0" +version = "1.2.1" authors = ["Zowe Project"] edition = "2018" license = "EPL-2.0" @@ -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"