|
28 | 28 | from wlsdeploy.aliases.aliases import Aliases
|
29 | 29 | from wlsdeploy.aliases.location_context import LocationContext
|
30 | 30 | from wlsdeploy.aliases.model_constants import DOMAIN_INFO
|
| 31 | +from wlsdeploy.aliases.validation_codes import ValidationCodes |
31 | 32 | from wlsdeploy.aliases.wlst_modes import WlstModes
|
32 | 33 | from wlsdeploy.exception import exception_helper
|
33 | 34 | from wlsdeploy.exception.expection_types import ExceptionType
|
@@ -315,19 +316,22 @@ def _establish_secure_mode(aliases, base_location, helper):
|
315 | 316 | try:
|
316 | 317 | secure_mode_location = LocationContext(base_location)
|
317 | 318 | 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)) |
331 | 335 | except PyWLSTException, pe:
|
332 | 336 | de = exception_helper.create_discover_exception('WLSDPLY-06038', pe.getLocalizedMessage())
|
333 | 337 | __logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
|
|
0 commit comments