Skip to content

Commit 9b2bae1

Browse files
Wdt security configuration (#717)
* remove default credentials under domain security * Remove variables from cache and properties file * WDT change to hardcode search for encrypted credentials
1 parent bf58995 commit 9b2bae1

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
from wlsdeploy.logging.platform_logger import PlatformLogger
2323
from wlsdeploy.tool.discover import discoverer
2424
from wlsdeploy.tool.discover.discoverer import Discoverer
25+
from wlsdeploy.tool.util.variable_injector import VARIABLE_SEP
2526
from wlsdeploy.tool.util.wlst_helper import WlstHelper
26-
from wlsdeploy.util import path_utils
2727
from wlsdeploy.util import string_utils
28+
from wlsdeploy.util import variables
29+
2830

2931
_class_name = 'TopologyDiscoverer'
3032
_logger = PlatformLogger(discoverer.get_discover_logger_name())
@@ -320,7 +322,7 @@ def discover_security_configuration(self):
320322
_logger.info('WLSDPLY-06622', class_name=_class_name, method_name=_method_name)
321323
location.add_name_token(self._aliases.get_name_token(location), security_configuration)
322324
self._populate_model_parameters(result, location)
323-
self._massage_security_credential(result)
325+
self._massage_security_credential(result, location)
324326
try:
325327
self._discover_subfolders(result, location)
326328
except DiscoverException, de:
@@ -477,22 +479,34 @@ def _get_xml_registries(self):
477479
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
478480
return model_top_folder_name, result
479481

480-
def _massage_security_credential(self, result):
482+
def _massage_security_credential(self, result, location):
481483
_method_name = 'massage_security_credential'
482484
# Determine if the SecurityConfiguration/CredentialEncrypted can be removed
485+
pass_cache = OrderedDict()
486+
short_name = ''
487+
if self._variable_injector is not None:
488+
pass_cache = self._variable_injector.get_variable_cache()
489+
short_name = self._variable_injector.get_folder_short_name(location)
483490
if model_constants.SECURITY_CONFIGURATION_PASSWORD in result:
484491
# default is false
485-
if model_constants.SECURITY_CONFIGURATION_CD_ENABLED in result and \
486-
Boolean.valueOf(result[model_constants.SECURITY_CONFIGURATION_CD_ENABLED]) == Boolean.TRUE:
487-
_logger.finer('WLSDPLY-06615', class_name=_class_name, method_name=_method_name)
488-
else:
492+
if model_constants.SECURITY_CONFIGURATION_CD_ENABLED not in result or \
493+
Boolean.valueOf(result[model_constants.SECURITY_CONFIGURATION_CD_ENABLED]) == Boolean.FALSE:
494+
# Hard code it here or hard code it later. The target code will bypass tokenize of variable
495+
cache_name = short_name + VARIABLE_SEP + model_constants.SECURITY_CONFIGURATION_PASSWORD
496+
if cache_name in pass_cache:
497+
del pass_cache[cache_name]
489498
del result[model_constants.SECURITY_CONFIGURATION_PASSWORD]
490499
_logger.fine('WLSDPLY-06616', class_name=_class_name, method_name=_method_name)
500+
else:
501+
_logger.finer('WLSDPLY-06615', class_name=_class_name, method_name=_method_name)
491502
# Determine if the SecurityConfiguration/NodeManagerEncryptedPassword can be removed
492503
if model_constants.SECURITY_CONFIGURATION_NM_PASSWORD in result:
493504
if model_constants.MACHINE in self._dictionary or model_constants.UNIX_MACHINE in self._dictionary:
494505
_logger.finer('WLSDPLY-06645', class_name=_class_name, method_name=_method_name)
495506
else:
507+
cache_name = short_name + VARIABLE_SEP + model_constants.SECURITY_CONFIGURATION_NM_PASSWORD
508+
if cache_name in pass_cache:
509+
del pass_cache[cache_name]
496510
del result[model_constants.SECURITY_CONFIGURATION_NM_PASSWORD]
497511
_logger.finer('WLSDPLY-06646', class_name=_class_name, method_name=_method_name)
498512

0 commit comments

Comments
 (0)