zowe / zowe-cli

Zowe CLI
Eclipse Public License 2.0
116 stars 86 forks source link

ProfileInfo API fails to load base profile when Global User Config exists #2273

Open t1m0thyj opened 2 months ago

t1m0thyj commented 2 months ago

Actual Behavior When a Global User Config w/o base profile is created to override some properties of a Global Config with base profile, then ZE doesn't load the base profile.

Expected Behavior The ProfileInfo API should merge Global Config and Global User Config layers and load the base profile.

Steps to Reproduce

  1. Create a Global Config that includes a base profile with host property.
  2. Create a Global User Config that contains only a zosmf profile with port property.
  3. Try to use the zosmf profile in Zowe Explorer and notice missing hostname errors.

Additional Details https://github.com/zowe/zowe-cli/blob/606d579cdd5b070cdffd949926152b94b60dcd44/packages/imperative/src/config/src/ProfileInfo.ts#L559-L564

This is the relevant code. I think it could be fixed by adding the following between lines 561-562:

            if (!realBaseProfileName && osLoc.user) {
                layerProperties = this.mLoadedConfig.findLayer(false, osLoc.global)?.properties;
                realBaseProfileName = layerProperties?.defaults.base;
            }
github-actions[bot] commented 2 months ago

Thank you for creating a bug report. We will investigate the bug and evaluate its impact on the product. If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.

zFernand0 commented 2 months ago

Related to ZE e2e testing

When(/a user who has profile with (.*) auth in team config/, function (authType: string) {
    // TODO: We need to copy from Global Config until Imperative API is fixed
    // See https://github.com/zowe/zowe-cli/issues/2273