73
73
from wlsdeploy .aliases .model_constants import XML_REGISTRY
74
74
from wlsdeploy .aliases .wlst_modes import WlstModes
75
75
from wlsdeploy .exception import exception_helper
76
+ from wlsdeploy .logging .platform_logger import PlatformLogger
76
77
from wlsdeploy .tool .util .wlst_helper import WlstHelper
77
78
from wlsdeploy .util import model_helper
79
+ from wlsdeploy .util .weblogic_helper import WebLogicHelper
78
80
79
81
80
82
class AttributeSetter (object ):
@@ -140,13 +142,15 @@ class AttributeSetter(object):
140
142
]
141
143
142
144
_class_name = "AttributeSetter"
145
+ __logger = PlatformLogger ('wlsdeploy.tool.util' )
143
146
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
146
149
self .__exception_type = exception_type
147
150
self .__wlst_mode = wlst_mode
148
151
self .__aliases = aliases
149
152
self .__wlst_helper = WlstHelper (exception_type )
153
+ self .__weblogic_helper = WebLogicHelper (self .__logger )
150
154
151
155
#
152
156
# 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):
594
598
:param key: the attribute name
595
599
:param value: the string value
596
600
: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
598
602
"""
599
603
if value is None or len (value ) == 0 :
600
604
result = value
@@ -618,7 +622,7 @@ def set_boolean(self, location, key, value, wlst_value):
618
622
:param key: the attribute name
619
623
:param value: the string value
620
624
: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
622
626
"""
623
627
result = alias_utils .convert_to_type (BOOLEAN , value )
624
628
result = result == 'true'
@@ -633,14 +637,29 @@ def set_with_ssl_enabled(self, location, key, value, wlst_value):
633
637
:param key: the attribute name
634
638
:param value: the new attribute value
635
639
: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
637
641
"""
638
642
wlst_enabled_attribute = self .__aliases .get_wlst_attribute_name (location , ENABLED )
639
643
was_enabled = self .__wlst_helper .get (wlst_enabled_attribute )
640
644
self .set_attribute (location , ENABLED , True )
641
645
self .set_attribute (location , key , value , wlst_merge_value = wlst_value )
642
646
self .set_attribute (location , ENABLED , was_enabled )
643
647
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
+
644
663
#
645
664
# public set_attribute convenience methods
646
665
#
0 commit comments