Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

ProfileInfo APIs should not load layers when no projectDir is specified #883

Closed
zFernand0 opened this issue Sep 8, 2022 · 0 comments · Fixed by #884
Closed

ProfileInfo APIs should not load layers when no projectDir is specified #883

zFernand0 opened this issue Sep 8, 2022 · 0 comments · Fixed by #884
Assignees
Labels
bug Something isn't working

Comments

@zFernand0
Copy link
Member

We came across certain undesired behavior while investigating this issue (zowe/zowe-explorer-vscode#1802 (comment)).

When no projectDir is specified, the mProjectDir property defaults to / (C:\) and ProfileInfo attempts to load profiles in those directories.

         if (!teamCfgOpts.projectDir) {
            this.mLoadedConfig.mLayers[Layers.ProjectUser].exists = false;
            this.mLoadedConfig.mLayers[Layers.ProjectConfig].exists = false;
        }

This is not the same as disallowing the default look-up behavior. We still want to keep this behavior in the ProfileInfo APIs in order to keep ZE and CLI consistent. This snippet may illustrate what disabling all project config loading looks like when there is no VSCode workspace open

        if (teamCfgOpts.projectDir) {
            if (path.dirname(this.mLoadedConfig.mLayers[Layers.ProjectUser].path) !== teamCfgOpts.projectDir) 
                this.mLoadedConfig.mLayers[Layers.ProjectUser].exists = false;
            if (path.dirname(this.mLoadedConfig.mLayers[Layers.ProjectConfig].path) !== teamCfgOpts.projectDir) 
                this.mLoadedConfig.mLayers[Layers.ProjectConfig].exists = false;
        }
@zFernand0 zFernand0 added the bug Something isn't working label Sep 8, 2022
@zFernand0 zFernand0 self-assigned this Sep 8, 2022
@zFernand0 zFernand0 changed the title ProfileInfo APIs should not load layers which paths do not match the projectDir specified ProfileInfo APIs should not load layers when no projectDir is specified Sep 8, 2022
@zFernand0 zFernand0 removed their assignment Sep 8, 2022
@t1m0thyj t1m0thyj self-assigned this Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants