Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/core/zowe/core_for_zowe_sdk/profile_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ def load(
profile_type: Optional[str] = None,
check_missing_props: bool = True,
validate_schema: Optional[bool] = True,
override_with_env: Optional[bool] = False
validate_only_project_config: Optional[bool] = False,
override_with_env: Optional[bool] = False,
) -> dict[str, Any]:
"""
Load connection details from a team config profile.
Expand Down Expand Up @@ -405,10 +406,20 @@ def load(
self.__global_config,
):
if cfg_layer.profiles is None:

layer_validate_schema = validate_schema

if validate_only_project_config:
layer_validate_schema = cfg_layer == self.__project_config

try:
cfg_layer.init_from_file(validate_schema)
cfg_layer.init_from_file(layer_validate_schema)

except SecureProfileLoadFailed:
self.__logger.warning(f"Could not load secure properties for {cfg_layer.filepath}")
self.__logger.warning(
f"Could not load secure properties for {cfg_layer.filepath}"
)

warnings.warn(
f"Could not load secure properties for {cfg_layer.filepath}",
SecurePropsNotFoundWarning,
Expand Down Expand Up @@ -452,7 +463,13 @@ def load(

if profile_type != BASE_PROFILE:
profile_props = {
**self.load(profile_type=BASE_PROFILE, check_missing_props=False),
**self.load(
profile_type=BASE_PROFILE,
check_missing_props=False,
validate_schema=validate_schema,
validate_only_project_config=validate_only_project_config,
override_with_env=override_with_env,
),
**profile_props,
}

Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class TestZosmfWorkflowsIntegration(unittest.TestCase):

def setUp(self):
"""Setup fixtures for Zosmf class."""
test_profile = ProfileManager(show_warnings=False).load(profile_type="zosmf")
test_profile = ProfileManager(show_warnings=False).load(
profile_type="zosmf",
validate_only_project_config=True,
)
self.workflows = Workflows(test_profile)
self.files = Files(test_profile)
self.addCleanup(lambda: self.workflows.__exit__(None, None, None))
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_zos_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class TestConsoleIntegration(unittest.TestCase):

def setUp(self):
"""Setup fixtures for Console class."""
test_profile = ProfileManager(show_warnings=False).load(profile_type="zosmf")
test_profile = ProfileManager(show_warnings=False).load(
profile_type="zosmf",
validate_only_project_config=True,
)
self.console = Console(test_profile)
self.addCleanup(lambda: self.console.__exit__(None, None, None))

Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_zos_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class TestFilesIntegration(unittest.TestCase):

def setUp(self):
"""Setup fixtures for Files class."""
test_profile = ProfileManager(show_warnings=False).load(profile_type="zosmf")
test_profile = ProfileManager(show_warnings=False).load(
profile_type="zosmf",
validate_only_project_config=True,
)
self.user_name = test_profile["user"]
with open(FILES_FIXTURES_PATH, "r") as fixtures_json:
self.files_fixtures = json.load(fixtures_json)
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_zos_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class TestJobsIntegration(unittest.TestCase):

def setUp(self):
"""Setup fixtures for Jobs class."""
test_profile = ProfileManager(show_warnings=False).load(profile_type="zosmf")
test_profile = ProfileManager(show_warnings=False).load(
profile_type="zosmf",
validate_only_project_config=True,
)
with open(JOBS_FIXTURES_JSON_JSON_PATH, "r") as fixtures_json:
self.jobs_fixtures_json = json.load(fixtures_json)
self.jobs = Jobs(test_profile)
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_zos_tso.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class TestTsoIntegration(unittest.TestCase):

def setUp(self):
"""Setup fixtures for Tso class."""
test_profile = ProfileManager(show_warnings=False).load(profile_type="zosmf")
test_profile = ProfileManager(show_warnings=False).load(
profile_type="zosmf",
validate_only_project_config=True,
)
self.tso = Tso(test_profile, {"account": "IZUACCT"})
self.addCleanup(lambda: self.tso.__exit__(None, None, None))

Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_zosmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class TestZosmfIntegration(unittest.TestCase):

def setUp(self):
"""Setup fixtures for Zosmf class."""
test_profile = ProfileManager(show_warnings=False).load(profile_type="zosmf")
test_profile = ProfileManager(show_warnings=False).load(
profile_type="zosmf",
validate_only_project_config=True,
)
self.zosmf = Zosmf(test_profile)
self.addCleanup(lambda: self.zosmf.__exit__(None, None, None))

Expand Down
Loading