zowe / zowe-cli

Zowe CLI
Eclipse Public License 2.0
108 stars 85 forks source link

How to access a root untyped profile using profInfo.getAllProfiles? #2185

Open davidkjackson54 opened 4 days ago

davidkjackson54 commented 4 days ago

I have a VSCode Explorer extension where I allow the user to manage credentials. This works fine for the instance whereby the secureArgs are present in the system profile - or defined in the default base profile.

However, there is an article from the zowe folk - https://medium.com/zowe/password-management-for-zowe-cli-profiles-c57f64d1fe88 suggesting that the preferred method is to not use the base profile but instead specify a top level root profile that is untyped.

Something like this:

SecureArgs are present in the top level but also in a system profile to allow the user to specifically enter credentials for that system. The problem arises in that there seems to be no obvious method in a VSCode extension to get that top level untyped profile . I use profInfo.readProfilesfromDIsk followed by profInfo.getAllProfiles but you can only retrieve typed profiles.

There doesn't seem to be any way of retrieving that top level untyped profile - or indeed know if such a top level profile exists.
Equally how do I update an untyped profile as profInfo.,updateProperty takes in propOpts one of which iso the profile name - so won't work for an untyped profile.

{
    "$schema": "./zowe.schema.json",
    "profiles": {
     "D001": {
       "properties": {
         "host": "myHost",
          "protocol": "https",
          "rejectUnauthorized": false,
       },
       **"secure": [
         "user",
         "password"
       ],**
       "profiles": {
           "u830all": {
             "type": "zmf",
             "properties": {            
               "port": 9990
             }
         },
           "u830dp": {
             "type": "zmf",
             "properties": {
              "port": 9991
             },
             **"secure": [
                "user",
               "password"
             ]**
          }
        }
       }
     }
  }
github-actions[bot] commented 4 days 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.