question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ZE API: cannot append properties to a custom profile with user-specific config file

See original GitHub issue

Describe the bug

I have created an additional zowe.config.user.json file to accompany my zowe.config.json with existing profiles (see examples in the Additional context section). The idea is to append some user specific fields to the existing profile from global team config using the user-specific config.

But on the initialization of Zowe Explorer API I keep getting the error:

'ProfInfoErr: Failed to find property rejectUnauthorized in the profile base_def'

(to be precise: during the profiles reloading ZoweVsCodeExtension.getZoweExplorerApi().getExplorerExtenderApi().reloadProfiles())

In the same time Zowe CLI seems to work good with this setup.

The only workaround I found so far is to duplicate the base_defprofile in the user-specific config, in this case it is possible to pass the profiles reloading and to use the merged profile successfully.

Expected behavior

ZE API should allow to retrieve the profiles merged from global and user configs.

Desktop (please complete the following information):

  • OS: MacOS
  • Zowe Explorer Version: 2.2.0
  • (Optional) Zowe CLI Version: 7.4.0
  • (Optional) Are you using Secure Credential Store? Yes

Additional context

We have a zowe.config.json with some custom profiles:

{
    "$schema": "./zowe.schema.json",
    "profiles": {
        "base_def": {
            "type": "base",
            "properties": {
                "rejectUnauthorized": false
            },
            "secure": [
                "user",
                "password"
            ]
        },
        "test": {
            "type": "endevor",
            "properties": {
                "host": "test.com",
                "port": 1234,
                "protocol": "http",
                "basePath": "/"
            },
            "secure": []
        },
        "test-location": {
            "type": "endevor-location",
            "properties": {
                "instance": "INST",
                "environment": "ENV",
                "system": "SYS",
                "subsystem": "SBS",
                "stageNumber": "1",
                "type": "*"
            },
            "secure": []
        },
        "test-zosmf": {
            "type": "zosmf",
            "properties": {
                "host": "1.2.3.4",
                "port": 43,
                "protocol": "https"
            },
            "secure": [
                "user",
                "password"
            ]
        },
    },
    "defaults": {
        "base": "base_def",
        "endevor": "test",
        "endevor-location": "test-location",
        "zosmf": "test-zosmf"
    },
    "autoStore": true
}

And a zowe.config.user.json:

{
    "$schema": "./zowe.schema.json",
    "profiles": {
        "test-location": {
            "type": "endevor-location",
            "properties": {
                "ccid": "develop1",
                "comment": "Changes by develop1"
            },
            "secure": []
        }
    },
    "defaults": {},
    "autoStore": true
}

Both are in .zowe directory.

Zowe CLI output:

❯ zowe config ls
profiles: 
  base_def: 
    type:       base
    properties: 
      rejectUnauthorized: false
      user:               (secure value)
      password:           (secure value)
    secure: 
      - user
      - password
  test: 
    type:       endevor
    properties: 
      host:     test.com
      port:     1234
      protocol: http
      basePath: /
    secure: 
      (empty array)
  test-location: 
    type:       endevor-location
    properties: 
      instance:    INST
      environment: ENV
      system:      SYS
      subsystem:   SBS
      stageNumber: 1
      type:        *
      ccid:        develop1
      comment:     Changes by develop1
    secure: 
      (empty array)
  test-zosmf: 
    type:       zosmf
    properties: 
      host:        1.2.3.4
      port:        43
      protocol:    https
    secure: 
      - user
      - password
defaults: 
  base:             base_def
  endevor:          test
  endevor-location: test-location
  zosmf:            test-zosmf
autoStore: true

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
roman-kupriyanovcommented, Oct 4, 2022

Hi @zFernand0

Good news, I have tested the latest ZE v2.3.0 with our extension and team/user config setup, described above, and now it is initialized properly without errors, yay! Thank you for the help 😃

I have noticed some kind of a related issue for ZE though. Now it does not respect a base profile specified in the User config on the global level (in ~/.zowe folder), but it seems that it respects it on the project level (if an opened VSCode workspace folder includes Team and User configs). In the same time I tried the same setup with Zowe CLI v7.6.2 and it work fine with the global level User configs too.

I must say I do not know where exactly it is expected for User config to be located (probably, most of the time on the project level, not on the global one), but since Zowe CLI support both scenarios, I would expect ZE to do the same. And we actually have some customers who might be interested to specify their base profile in User config, not to be shareable with anyone else.

Examples:

~/.zowe/zowe.config.json config:

{
  "$schema": "./zowe.schema.json",
  "profiles": {
      "test": {
          "type": "endevor",
          "properties": {
              "host": "test.com",
              "port": 1234,
              "protocol": "http",
              "basePath": "/"
          },
          "secure": []
      },
      "test-location": {
          "type": "endevor-location",
          "properties": {
              "instance": "INST",
              "environment": "ENV",
              "system": "SYS",
              "subsystem": "SBS",
              "stageNumber": "1",
              "type": "*"
          },
          "secure": []
      },
      "test-zosmf": {
          "type": "zosmf",
          "properties": {
              "host": "1.2.3.4",
              "port": 43,
              "protocol": "https"
          },
          "secure": [
              "user",
              "password"
          ]
      },
  },
  "defaults": {
      "endevor": "test",
      "endevor-location": "test-location",
      "zosmf": "test-zosmf"
  },
  "autoStore": true
}

And ~/.zowe/zowe.config.user.json config:

{
    "$schema": "./zowe.schema.json",
    "profiles": {
        "base_def": {
            "type": "base",
            "properties": {
                "rejectUnauthorized": false
            },
            "secure": [
                "user",
                "password"
            ]
        },
        "test-location": {
            "type": "endevor-location",
            "properties": {
                "ccid": "develop1",
                "comment": "Changes by develop1"
            },
            "secure": []
        }
    },
    "defaults": {
        "base": "base_def"
    },
    "autoStore": true
}

Zowe CLI output:

❯ zowe config ls
profiles: 
  test: 
    type:       endevor
    properties: 
      host:     test.com
      port:     1234
      protocol: http
      basePath: /
    secure: 
      (empty array)
  test-location: 
    type:       endevor-location
    properties: 
      instance:    INST
      environment: ENV
      system:      SYS
      subsystem:   SBS
      stageNumber: 1
      type:        *
      ccid:        develop1
      comment:     Changes by develop1
    secure: 
      (empty array)
  test-zosmf: 
    type:       zosmf
    properties: 
      host:        1.2.3.4
      port:        43
      protocol:    https
    secure: 
      - user
      - password
  base_def: 
    type:       base
    properties: 
      rejectUnauthorized: false
      user:               (secure value)
      password:           (secure value)
    secure: 
      - user
      - password
defaults: 
  base:             base_def
  endevor:          test
  endevor-location: test-location
  zosmf:            test-zosmf
autoStore: true

I have even tried this weird flow and it worked:

  • Set the zowe.config.json and zowe.config.user.json configs in ~/.zowe folder.
  • Open any folder without configs in VSCode (or do not open at all): the extension have no information about credentials specified (the base profile is not merged it seems).
  • Open ~/.zowe folder in VSCode (with Open Folder dialog): and now it detects the base profile information.

Because of this scenario I have an assumption about that it works only with the project level configs and not global ones. But maybe something else is involved. In the same time Zowe CLI works in all cases, whether you are in the ~/.zowe folder or in any else.

1reaction
zFernand0commented, Sep 1, 2022

This sounds related to zowe/imperative#881

@roman-kupriyanov, once ZE v2.3 is out, could you confirm if the issue still persists?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't access custom profile properties from web.config?
When I try to access the Profile.CustomerName or Profile.CustomerID from an aspx.cs file, it doesn't show up. I thought when you create a...
Read more >
Configuration Reference Guide - Quarkus
config.profile.parent must be placed in the main application.properties file, passed as a system property, or passed as an environment variable.
Read more >
Spring Boot Reference Documentation
Try the How-to documents. They provide solutions to the most common questions. Learn the Spring basics. Spring Boot builds on many other Spring...
Read more >
ProfileBase Class (System.Web.Profile) - Microsoft Learn
The following code example shows a Web.config file that specifies a user profile that contains a ZipCode property of type string and a...
Read more >
Spring Method Security with PreAuthorize - Okta Developer
Try adding a custom scope. Change okta.oauth2.scopes property in the application.yml file to match: okta: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found