@@ -437,7 +437,7 @@ def __discover(model_context, aliases, credential_injector, helper, extra_tokens
437437 try :
438438 _add_domain_name (base_location , aliases , helper )
439439 _establish_production_mode (aliases , helper )
440- _establish_secure_mode (aliases , base_location , helper )
440+ _establish_secure_mode (aliases , base_location , helper , model_context )
441441
442442 DomainInfoDiscoverer (model_context , model .get_model_domain_info (), base_location , wlst_mode = __wlst_mode ,
443443 aliases = aliases , credential_injector = credential_injector ).discover ()
@@ -504,16 +504,25 @@ def _establish_production_mode(aliases, helper):
504504 raise de
505505
506506
507- def _establish_secure_mode (aliases , base_location , helper ):
507+ def _establish_secure_mode (aliases , base_location , helper , model_context ):
508508 """
509509 Determine if secure mode is enabled for the domain, and set it in the aliases.
510510 :param aliases: aliases instance for discover
511511 :param base_location: location of root directory in WLST
512512 :param helper: wlst_helper instance
513+ :param model_context: used to check dependency
513514 :raises DiscoverException: if an error occurs during discovery
514515 """
515516 _method_name = '_establish_secure_mode'
516517 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+
517526 secure_mode_location = LocationContext (base_location )
518527 secure_mode_location .append_location (model_constants .SECURITY_CONFIGURATION )
519528
@@ -530,8 +539,10 @@ def _establish_secure_mode(aliases, base_location, helper):
530539 secure_mode_location .add_name_token (aliases .get_name_token (secure_mode_location ), secure_mode_token )
531540 helper .cd (aliases .get_wlst_attributes_path (secure_mode_location ))
532541 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+
535546 except PyWLSTException , pe :
536547 de = exception_helper .create_discover_exception ('WLSDPLY-06038' , pe .getLocalizedMessage ())
537548 __logger .throwing (class_name = _class_name , method_name = _method_name , error = de )
0 commit comments