|
3 | 3 | Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. |
4 | 4 | """ |
5 | 5 | from java.io import File |
| 6 | +from java.lang import Boolean |
6 | 7 | from java.lang import IllegalArgumentException |
7 | 8 |
|
8 | 9 | from oracle.weblogic.deploy.discover import DiscoverException |
@@ -83,6 +84,7 @@ def discover(self): |
83 | 84 | model_top_folder_name, machines = self.get_machines(unix_machines) |
84 | 85 | discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, machines) |
85 | 86 |
|
| 87 | + # make sure this is after discovery of machines / node managers as we will do some massaging |
86 | 88 | model_top_folder_name, security_configuration = self.discover_security_configuration() |
87 | 89 | discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, security_configuration) |
88 | 90 |
|
@@ -318,6 +320,7 @@ def discover_security_configuration(self): |
318 | 320 | _logger.info('WLSDPLY-06622', class_name=_class_name, method_name=_method_name) |
319 | 321 | location.add_name_token(self._aliases.get_name_token(location), security_configuration) |
320 | 322 | self._populate_model_parameters(result, location) |
| 323 | + self._massage_security_credential(result) |
321 | 324 | try: |
322 | 325 | self._discover_subfolders(result, location) |
323 | 326 | except DiscoverException, de: |
@@ -474,6 +477,25 @@ def _get_xml_registries(self): |
474 | 477 | _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) |
475 | 478 | return model_top_folder_name, result |
476 | 479 |
|
| 480 | + def _massage_security_credential(self, result): |
| 481 | + _method_name = 'massage_security_credential' |
| 482 | + # Determine if the SecurityConfiguration/CredentialEncrypted can be removed |
| 483 | + if model_constants.SECURITY_CONFIGURATION_PASSWORD in result: |
| 484 | + # 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: |
| 489 | + del result[model_constants.SECURITY_CONFIGURATION_PASSWORD] |
| 490 | + _logger.fine('WLSDPLY-06616', class_name=_class_name, method_name=_method_name) |
| 491 | + # Determine if the SecurityConfiguration/NodeManagerEncryptedPassword can be removed |
| 492 | + if model_constants.SECURITY_CONFIGURATION_NM_PASSWORD in result: |
| 493 | + if model_constants.MACHINE in self._dictionary or model_constants.UNIX_MACHINE in self._dictionary: |
| 494 | + _logger.finer('WLSDPLY-06645', class_name=_class_name, method_name=_method_name) |
| 495 | + else: |
| 496 | + del result[model_constants.SECURITY_CONFIGURATION_NM_PASSWORD] |
| 497 | + _logger.finer('WLSDPLY-06646', class_name=_class_name, method_name=_method_name) |
| 498 | + |
477 | 499 | def _has_machines_folder(self, base_folder): |
478 | 500 | """ |
479 | 501 | This is a private method. |
|
0 commit comments