@@ -437,7 +437,7 @@ def __discover(model_context, aliases, credential_injector, helper, extra_tokens
437
437
try :
438
438
_add_domain_name (base_location , aliases , helper )
439
439
_establish_production_mode (aliases , helper )
440
- _establish_secure_mode (aliases , base_location , helper )
440
+ _establish_secure_mode (aliases , base_location , helper , model_context )
441
441
442
442
DomainInfoDiscoverer (model_context , model .get_model_domain_info (), base_location , wlst_mode = __wlst_mode ,
443
443
aliases = aliases , credential_injector = credential_injector ).discover ()
@@ -504,16 +504,25 @@ def _establish_production_mode(aliases, helper):
504
504
raise de
505
505
506
506
507
- def _establish_secure_mode (aliases , base_location , helper ):
507
+ def _establish_secure_mode (aliases , base_location , helper , model_context ):
508
508
"""
509
509
Determine if secure mode is enabled for the domain, and set it in the aliases.
510
510
:param aliases: aliases instance for discover
511
511
:param base_location: location of root directory in WLST
512
512
:param helper: wlst_helper instance
513
+ :param model_context: used to check dependency
513
514
:raises DiscoverException: if an error occurs during discovery
514
515
"""
515
516
_method_name = '_establish_secure_mode'
516
517
try :
518
+ if model_context .get_weblogic_helper ().is_secure_mode_implied_by_production_mode ():
519
+ # for 14.1.2, secure mode defaults to true if production mode is true.
520
+ # this may be overridden by the value of SecurityConfiguration/SecureMode/SecureModeEnabled.
521
+ helper .cd ('/' )
522
+ secure_mode_enabled = helper .get (model_constants .PRODUCTION_MODE_ENABLED )
523
+ else :
524
+ secure_mode_enabled = False
525
+
517
526
secure_mode_location = LocationContext (base_location )
518
527
secure_mode_location .append_location (model_constants .SECURITY_CONFIGURATION )
519
528
@@ -530,8 +539,10 @@ def _establish_secure_mode(aliases, base_location, helper):
530
539
secure_mode_location .add_name_token (aliases .get_name_token (secure_mode_location ), secure_mode_token )
531
540
helper .cd (aliases .get_wlst_attributes_path (secure_mode_location ))
532
541
secure_mode_enabled = helper .get (model_constants .SECURE_MODE_ENABLED )
533
- aliases .set_secure_mode (secure_mode_enabled )
534
- helper .cd (aliases .get_wlst_attributes_path (base_location ))
542
+
543
+ aliases .set_secure_mode (secure_mode_enabled )
544
+ helper .cd (aliases .get_wlst_attributes_path (base_location ))
545
+
535
546
except PyWLSTException , pe :
536
547
de = exception_helper .create_discover_exception ('WLSDPLY-06038' , pe .getLocalizedMessage ())
537
548
__logger .throwing (class_name = _class_name , method_name = _method_name , error = de )
0 commit comments