ProfileManager

class core.zowe.core_for_zowe_sdk.ProfileManager(appname: str = 'zowe', show_warnings: bool = True)

Profile Manager contains the logic to merge the different properties of profiles (from the Project Config and the Project User Config as well as the Global Config and Global User Config). This class handles all the exceptions raised in the Config File to provide a smooth user experience.

property config_appname: str

Returns the app name

property config_dir: str | None

Returns the folder path to where the Zowe z/OSMF Team Project Config files are located.

property config_filename: str

Return the filename for Zowe z/OSMF Team Project Config

property config_filepath: str | None

Get the full Zowe z/OSMF Team Project Config filepath

static get_env(cfg: ConfigFile, cwd=None) dict

Maps the env variables to the profile properties

Returns:

Containing profile properties from env variables (prop: value)

Return type:

Dictionary

get_highest_priority_layer(json_path: str) ConfigFile | None

Get the highest priority layer (configuration file) based on the given profile name

Parameters:

profile_name (str): The name of the profile to look for in the layers.

Returns:
Optional[ConfigFile]: The highest priority layer (configuration file) that contains the specified profile,

or None if the profile is not found in any layer.

static get_profile(cfg: ConfigFile, profile_name: str | None, profile_type: str | None, validate_schema: bool | None = True) Profile

Get just the profile from the config file (overriden with base props in the config file)

Returns:

NamedTuple (data, name, secure_props_not_found)

Return type:

Profile

load(profile_name: str | None = None, profile_type: str | None = None, check_missing_props: bool = True, validate_schema: bool | None = True, override_with_env: bool | None = False) dict

Load connection details from a team config profile. :returns: * dictionary – Object containing connection details

  • We will load properties from config files in the following order, from

  • highest to lowest priority

  • 1. Project User Config (./zowe.config.user.json)

  • 2. Project Config (./zowe.config.json)

  • 3. Global User Config (~/zowe.config.user.json)

  • 4. Global Config (~/zowe.config.json)

  • If profile_type is not base, then we will load properties from both

  • profile_type and base profiles and merge them together.

save() None

Save the layers (configuration files) to disk.

set_profile(profile_path: str, profile_data: dict) None

Set a profile in the highest priority layer (configuration file) based on the given profile name

Parameters:

profile_path (str): TThe path of the profile to be set. eg: profiles.zosmf profile_data (dict): The data of the profile to set.

set_property(json_path, value, secure=None) None

Set a property in the profile, storing it securely if necessary.

Parameters:

json_path (str): The JSON path of the property to set. value (str): The value to be set for the property. secure (bool): If True, the property will be stored securely. Default is None.

property user_config_dir: str | None

Returns the folder path to where the Zowe z/OSMF User Project Config files are located.