Skip to content

Commit 7f4776c

Browse files
committed
Merge branch 'issue-#1467-secure-mode-version' into 'main'
Check if secure mode location is valid before getting value See merge request weblogic-cloud/weblogic-deploy-tooling!1471
2 parents 621adb5 + dd971ad commit 7f4776c

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

core/src/main/python/discover.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from wlsdeploy.aliases.aliases import Aliases
2929
from wlsdeploy.aliases.location_context import LocationContext
3030
from wlsdeploy.aliases.model_constants import DOMAIN_INFO
31+
from wlsdeploy.aliases.validation_codes import ValidationCodes
3132
from wlsdeploy.aliases.wlst_modes import WlstModes
3233
from wlsdeploy.exception import exception_helper
3334
from wlsdeploy.exception.expection_types import ExceptionType
@@ -315,19 +316,22 @@ def _establish_secure_mode(aliases, base_location, helper):
315316
try:
316317
secure_mode_location = LocationContext(base_location)
317318
secure_mode_location.append_location(model_constants.SECURITY_CONFIGURATION)
318-
security_config_path = aliases.get_wlst_list_path(secure_mode_location)
319-
security_config_token = helper.get_singleton_name(security_config_path)
320-
secure_mode_location.add_name_token(aliases.get_name_token(secure_mode_location), security_config_token)
321-
322-
secure_mode_location.append_location(model_constants.SECURE_MODE)
323-
secure_mode_path = aliases.get_wlst_list_path(secure_mode_location)
324-
secure_mode_token = helper.get_singleton_name(secure_mode_path)
325-
if secure_mode_token is not None:
326-
secure_mode_location.add_name_token(aliases.get_name_token(secure_mode_location), secure_mode_token)
327-
helper.cd(aliases.get_wlst_attributes_path(secure_mode_location))
328-
secure_mode_enabled = helper.get(model_constants.SECURE_MODE_ENABLED)
329-
aliases.set_secure_mode(secure_mode_enabled)
330-
helper.cd(aliases.get_wlst_attributes_path(base_location))
319+
320+
code, message = aliases.is_valid_model_folder_name(secure_mode_location, model_constants.SECURE_MODE)
321+
if code == ValidationCodes.VALID:
322+
security_config_path = aliases.get_wlst_list_path(secure_mode_location)
323+
security_config_token = helper.get_singleton_name(security_config_path)
324+
secure_mode_location.add_name_token(aliases.get_name_token(secure_mode_location), security_config_token)
325+
326+
secure_mode_location.append_location(model_constants.SECURE_MODE)
327+
secure_mode_path = aliases.get_wlst_list_path(secure_mode_location)
328+
secure_mode_token = helper.get_singleton_name(secure_mode_path)
329+
if secure_mode_token is not None:
330+
secure_mode_location.add_name_token(aliases.get_name_token(secure_mode_location), secure_mode_token)
331+
helper.cd(aliases.get_wlst_attributes_path(secure_mode_location))
332+
secure_mode_enabled = helper.get(model_constants.SECURE_MODE_ENABLED)
333+
aliases.set_secure_mode(secure_mode_enabled)
334+
helper.cd(aliases.get_wlst_attributes_path(base_location))
331335
except PyWLSTException, pe:
332336
de = exception_helper.create_discover_exception('WLSDPLY-06038', pe.getLocalizedMessage())
333337
__logger.throwing(class_name=_class_name, method_name=_method_name, error=de)

0 commit comments

Comments
 (0)