Skip to content

Commit fa1256f

Browse files
jshum2479robertpatrick
authored andcommitted
fix discover regular datasource password
1 parent 1680a0c commit fa1256f

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

core/src/main/python/discover.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ def __fix_discovered_template_datasource(model, model_context, credential_inject
830830
prefixes = HashSet()
831831
properties = __get_urls_and_passwords(jdbc_system_resources, filtered_ds_patterns,
832832
urls, passwords, prefixes)
833-
if _can_generate_rcudb_info(passwords, urls, prefixes):
833+
if _can_generate_rcudb_info(model_context, passwords, urls, prefixes):
834834
__set_rcuinfo_in_model(model, properties, urls.iterator().next(), passwords.iterator().next())
835835
__remove_discovered_template_datasource(jdbc_system_resources, filtered_ds_patterns, model)
836836
__fix_rcudbinfo_passwords(model, model_context, credential_injector)
@@ -840,8 +840,9 @@ def __fix_discovered_template_datasource(model, model_context, credential_inject
840840
__logger.exiting(_class_name, _method_name)
841841

842842

843-
def _can_generate_rcudb_info(passwords, urls, prefixes):
844-
return passwords.size() == 1 and urls.size() == 1 and prefixes.size() == 1
843+
def _can_generate_rcudb_info(model_context, passwords, urls, prefixes):
844+
return ((passwords.size() == 1 and urls.size() == 1 and prefixes.size() == 1) and
845+
model_context.get_model_config().get_discover_rcu_ds_generate_rcudb_info() == 'true')
845846

846847
def __get_urls_and_passwords(jdbc_system_resources, filtered_ds_patterns, urls, passwords, prefixes):
847848
properties = None

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

+5-7
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,10 @@ def _get_model_password_value(self, location, model_name, model_value):
395395
def _get_decrypted_password_and_is_filtered_datasource(self, location, model_value):
396396
# only do it for templated datasource
397397
filtered_datasource = self._is_filtered_datasource_location(location)
398-
if filtered_datasource:
399-
base_dir = self._model_context.get_domain_home()
400-
if self._model_context.is_ssh():
401-
base_dir = self.download_temporary_dir
402-
model_value = self._weblogic_helper.decrypt(model_value, base_dir)
403-
return filtered_datasource, model_value
398+
base_dir = self._model_context.get_domain_home()
399+
if self._model_context.is_ssh():
400+
base_dir = self.download_temporary_dir
401+
return filtered_datasource, self._weblogic_helper.decrypt(model_value, base_dir)
404402

405403
def _is_filtered_datasource_location(self, location):
406404
filtered_datasource = False
@@ -413,7 +411,7 @@ def _is_filtered_datasource_location(self, location):
413411
if filtered_datasource:
414412
return True
415413
return False
416-
414+
417415
def _get_attributes_for_current_location(self, location):
418416
"""
419417
Change to the mbean folder with the provided name using the current location and return

core/src/main/python/wlsdeploy/util/model_config.py

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
DEPLOY_TIMEOUT_DEFAULT = '180000'
3333
DISABLE_RCU_DROP_SCHEMA_PROP='disable.rcu.drop.schema'
3434
DISABLE_RCU_DROP_SCHEMA_DEFAULT='false'
35+
DISCOVER_RCU_DS_GENERATE_RCUDB_INFO_PROP='discover.rcu.ds.generate_rcudb_info'
36+
DISCOVER_RCU_DS_GENERATE_RCUDB_INFO_DEFAULT='true'
3537
ENABLE_CREATE_DOMAIN_PASSWORD_VALIDATION_PROP = 'enable.create.domain.password.validation'
3638
ENABLE_CREATE_DOMAIN_PASSWORD_VALIDATION_DEFAULT = 'true'
3739
REDEPLOY_TIMEOUT_PROP = 'redeploy.timeout'
@@ -204,6 +206,13 @@ def get_ssh_private_key_default_file_name(self):
204206
"""
205207
return self._get_from_dict(SSH_DEFAULT_PRIVATE_KEY_FILE_NAME_PROP, SSH_DEFAULT_PRIVATE_KEY_FILE_NAME_DEFAULT)
206208

209+
def get_discover_rcu_ds_generate_rcudb_info(self):
210+
"""
211+
Return the default for generate RCUDbInfo if all rcu datasource urls and passwords are the same. Default is true
212+
:return: the default for whether generating RCUDbInfo or not
213+
"""
214+
return self._get_from_dict(DISCOVER_RCU_DS_GENERATE_RCUDB_INFO_PROP, DISCOVER_RCU_DS_GENERATE_RCUDB_INFO_DEFAULT)
215+
207216
def use_ssh_compression(self):
208217
"""
209218
Return whether to use SSH compression.

0 commit comments

Comments
 (0)