7373from  wlsdeploy .aliases .model_constants  import  XML_REGISTRY 
7474from  wlsdeploy .aliases .wlst_modes  import  WlstModes 
7575from  wlsdeploy .exception  import  exception_helper 
76+ from  wlsdeploy .logging .platform_logger  import  PlatformLogger 
7677from  wlsdeploy .tool .util .wlst_helper  import  WlstHelper 
7778from  wlsdeploy .util  import  model_helper 
79+ from  wlsdeploy .util .weblogic_helper  import  WebLogicHelper 
7880
7981
8082class  AttributeSetter (object ):
@@ -140,13 +142,15 @@ class AttributeSetter(object):
140142 ]
141143
142144 _class_name  =  "AttributeSetter" 
145+  __logger  =  PlatformLogger ('wlsdeploy.tool.util' )
143146
144-  def  __init__ (self , aliases ,  logger , exception_type , wlst_mode = WlstModes .OFFLINE ):
145-  self .__logger  =  logger 
147+  def  __init__ (self , model_context ,  aliases , exception_type , wlst_mode = WlstModes .OFFLINE ):
148+  self .__model_context  =  model_context 
146149 self .__exception_type  =  exception_type 
147150 self .__wlst_mode  =  wlst_mode 
148151 self .__aliases  =  aliases 
149152 self .__wlst_helper  =  WlstHelper (exception_type )
153+  self .__weblogic_helper  =  WebLogicHelper (self .__logger )
150154
151155 # 
152156 # public set_ methods for special attribute types, signature (self, location, key, value, wlst_value, ...) 
@@ -594,7 +598,7 @@ def set_jvm_args(self, location, key, value, wlst_value):
594598 :param key: the attribute name 
595599 :param value: the string value 
596600 :param wlst_value: the existing value of the attribute from WLST 
597-  :raises BundleAwareException of the specified type: if target is not found  
601+  :raises BundleAwareException of the specified type: if an error occurs  
598602 """ 
599603 if  value  is  None  or  len (value ) ==  0 :
600604 result  =  value 
@@ -618,7 +622,7 @@ def set_boolean(self, location, key, value, wlst_value):
618622 :param key: the attribute name 
619623 :param value: the string value 
620624 :param wlst_value: the existing value of the attribute from WLST 
621-  :raises BundleAwareException of the specified type: if target is not found  
625+  :raises BundleAwareException of the specified type: if an error occurs  
622626 """ 
623627 result  =  alias_utils .convert_to_type (BOOLEAN , value )
624628 result  =  result  ==  'true' 
@@ -633,14 +637,29 @@ def set_with_ssl_enabled(self, location, key, value, wlst_value):
633637 :param key: the attribute name 
634638 :param value: the new attribute value 
635639 :param wlst_value: the existing value of the attribute from WLST 
636-  :raises BundleAwareException of the specified type: if target is not found  
640+  :raises BundleAwareException of the specified type: if an error occurs  
637641 """ 
638642 wlst_enabled_attribute  =  self .__aliases .get_wlst_attribute_name (location , ENABLED )
639643 was_enabled  =  self .__wlst_helper .get (wlst_enabled_attribute )
640644 self .set_attribute (location , ENABLED , True )
641645 self .set_attribute (location , key , value , wlst_merge_value = wlst_value )
642646 self .set_attribute (location , ENABLED , was_enabled )
643647
648+  def  set_encrypted (self , location , key , value , wlst_value ):
649+  """ 
650+  Set the specified attribute with a pre-encrypted value in the current location. 
651+  This is required when WLST does not encrypt a plain-text value during set() as it normally does. 
652+  This can happen when offline WLST does not include an attribute in a hard-coded list of encrypted values. 
653+  Currently, only OracleIdentityCloudIntegrator/ClientSecretEncrypted offline has this issue. 
654+  :param location: the location 
655+  :param key: the attribute name 
656+  :param value: the new attribute value 
657+  :param wlst_value: the existing value of the attribute from WLST 
658+  :raises BundleAwareException of the specified type: if an error occurs 
659+  """ 
660+  encrypted_value  =  self .__weblogic_helper .encrypt (str (value ), self .__model_context .get_domain_home ())
661+  self .set_attribute (location , key , encrypted_value , wlst_merge_value = wlst_value )
662+ 
644663 # 
645664 # public set_attribute convenience methods 
646665 # 
0 commit comments