zowe / zowe-client-python-sdk

Eclipse Public License 2.0
41 stars 28 forks source link

Missing Base Profile Warning for Python SDK but not Zowe CLI #327

Open dkelosky opened 3 months ago

dkelosky commented 3 months ago

If you create a zowe.config.json like this (with valid values for host/user/passwor):

{
    "$schema": "./zowe.schema.json",
    "profiles": {
        "sys1": {
            "type": "zosmf",
            "properties": {
                "port": 1443,
                "host": "sys1.mainframe.net",
                "user": "ibmuser",
                "password": "ibmpass"
            },
            "secure": []
        }
    },
    "defaults": {
        "zosmf": "sys1"
    },
    "autoStore": true
}

Then run python code such as:

from zowe.zos_jobs_for_zowe_sdk import Jobs
from zowe.core_for_zowe_sdk import ProfileManager

profile = ProfileManager().load(profile_type="zosmf")
jobs = Jobs(profile)
jobs_list = jobs.list_jobs()

for job in jobs_list:
    print(f"jobid: {job.jobid} is: {job.status}")

You get a warning like ProfileParsingWarning: "Given profile type 'base' has no default profile name" warnings.warn(

However, this same profile does not produce a warning for Zowe CLI. As a workaround you can add:

        "base": {
            "type": "base"
        }

And:

    "defaults": {
        "zosmf": "sys1",
        "base": "base"
    },
adam-wolfe commented 2 months ago

Suggestion: Move the warning to the log rather than outputting it to the terminal.

dkelosky commented 2 months ago

That suggestion is good; however, this config presents no warning for the CLI so I think the behavior is inconsistent.