Skip to content

Commit 33ae9c3

Browse files
committed
Merge branch 'wdt905' into 'main'
relax RCUDbinfo requirement for RCU type db, if RCBDbInfo is not provided, it... See merge request weblogic-cloud/weblogic-deploy-tooling!1758
2 parents 5b7e771 + 16c934a commit 33ae9c3

File tree

5 files changed

+100
-8
lines changed

5 files changed

+100
-8
lines changed

core/src/main/python/wlsdeploy/aliases/model_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
IPLANET_AUTHENTICATOR = 'IPlanetAuthenticator'
140140
JDBC_CONNECTION_POOL_PARAMS = 'JDBCConnectionPoolParams'
141141
JDBC_DATASOURCE_PARAMS = 'JDBCDataSourceParams'
142+
JDBC_DATASOURCE_PARAMS_DATASOURCE_LIST = 'DataSourceList'
142143
JDBC_DRIVER_PARAMS = 'JDBCDriverParams'
143144
JDBC_DRIVER_PARAMS_PROPERTIES = 'Properties'
144145
JDBC_DRIVER_PARAMS_PROPERTY = 'Property'

core/src/main/python/wlsdeploy/tool/create/rcudbinfo_helper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ def is_use_ssl(self):
293293
def __get_qualified_store_path(self, store_value):
294294
return get_qualified_store_path(self.get_tns_admin(), store_value)
295295

296+
def is_rcu_db_info_empty(self):
297+
if self.rcu_properties_map is not None and len(self.rcu_properties_map) == 0:
298+
return True
299+
return False
296300

297301
# "static" method for validation, etc.
298302
def get_qualified_store_path(tns_admin, store_value):

core/src/main/python/wlsdeploy/tool/util/rcu_helper.py

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY
4949
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY
5050
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_USER_PROPERTY
51+
from wlsdeploy.aliases.model_constants import JDBC_DATASOURCE_PARAMS
52+
from wlsdeploy.aliases.model_constants import JDBC_DATASOURCE_PARAMS_DATASOURCE_LIST
5153
from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS
5254
from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS_PROPERTIES
5355
from wlsdeploy.aliases.model_constants import JDBC_RESOURCE
@@ -105,19 +107,24 @@ def __init__(self, model_object, archive_helper, model_context, aliases, excepti
105107
####################
106108

107109
def check_or_run_rcu(self):
110+
111+
_method_name = 'check_or_run_rcu'
112+
108113
# This squelches the following error during JRF domain creation with an ATP database.
109114
#
110115
# ####<Mar 29, 2024 3:19:53 PM> <SEVERE> <FanManager> <configure> <> <attempt to configure
111116
# ONS in FanManager failed with oracle.ons.NoServersAvailable: Subscription time out>
112117
#
118+
113119
if self._rcu_db_info.is_use_atp():
114120
System.setProperty('oracle.jdbc.fanEnabled', 'false')
115121

116122
if self._model_context.get_domain_typedef().requires_rcu():
117123
if self._model_context.is_run_rcu():
118124
self.__run_rcu()
119125
else:
120-
self.__precheck_rcu_connectivity()
126+
if not self._rcu_db_info.is_rcu_db_info_empty():
127+
self.__precheck_rcu_connectivity()
121128

122129
def configure_fmw_infra_database(self):
123130
"""
@@ -128,7 +135,6 @@ def configure_fmw_infra_database(self):
128135
_method_name = 'configure_fmw_infra_database'
129136
self.__logger.entering(class_name=self.__class_name, method_name=_method_name)
130137

131-
# only continue with RCU configuration for domain type that requires RCU.
132138
if not self._domain_typedef.requires_rcu():
133139
self.__logger.finer('WLSDPLY-12249', class_name=self.__class_name, method_name=_method_name)
134140
return
@@ -237,15 +243,77 @@ def fix_jps_config(self):
237243
# PRIVATE METHODS
238244
####################
239245

246+
def __precheck_rcu_default_datasource_entries_for_norcu(self, default_ds_names):
247+
_method_name = '__precheck_rcu_default_datasource_entries_for_norcu'
248+
249+
resources_dict = self._model_object.get_model_resources()
250+
251+
not_found_ds_names = []
252+
if JDBC_SYSTEM_RESOURCE in resources_dict:
253+
ds_dict = resources_dict[JDBC_SYSTEM_RESOURCE]
254+
255+
if len(ds_dict) == 0:
256+
not_found_ds_names = default_ds_names
257+
else:
258+
for ds_name in default_ds_names:
259+
if ds_name not in ds_dict.keys():
260+
not_found_ds_names.append(ds_name)
261+
else:
262+
not_found_ds_names = default_ds_names
263+
264+
if len(not_found_ds_names) > 0:
265+
ex = exception_helper.create_create_exception('WLSDPLY-12285', not_found_ds_names)
266+
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
267+
raise ex
268+
269+
# Try best effort to test connectivity
270+
for ds_name in ds_dict.keys():
271+
try:
272+
datasource = ds_dict[ds_name]
273+
ds_resource = dictionary_utils.get_element(datasource, JDBC_RESOURCE)
274+
if ds_resource is None:
275+
continue
276+
datasource_param = dictionary_utils.get_element(ds_resource, JDBC_DATASOURCE_PARAMS, None)
277+
if datasource_param:
278+
source_list = dictionary_utils.get_element(datasource_param,
279+
JDBC_DATASOURCE_PARAMS_DATASOURCE_LIST, None)
280+
if source_list is not None:
281+
# skip test for multi datasource
282+
continue
283+
284+
driver_param = dictionary_utils.get_element(ds_resource, JDBC_DRIVER_PARAMS)
285+
if driver_param:
286+
jdbc_conn_string = dictionary_utils.get_element(driver_param, URL, None)
287+
model_ds_props = dictionary_utils.get_element(driver_param, JDBC_DRIVER_PARAMS_PROPERTIES, None)
288+
jdbc_driver_name = dictionary_utils.get_element(driver_param, DRIVER_NAME, None)
289+
conn_password = dictionary_utils.get_element(driver_param, PASSWORD_ENCRYPTED, None)
290+
props = Properties()
291+
if model_ds_props is not None:
292+
for item in model_ds_props.keys():
293+
props.put(item, model_ds_props[item]['Value'])
294+
if conn_password:
295+
props.put('password', conn_password)
296+
# skip test if they are none and let it fail during create with default value from the template
297+
if jdbc_driver_name and jdbc_conn_string and conn_password:
298+
self.__logger.fine("WLSDPLY-12288", ds_name)
299+
JClass.forName(jdbc_driver_name)
300+
DriverManager.getConnection(jdbc_conn_string, props)
301+
except JException, e:
302+
ex = exception_helper.create_create_exception("WLSDPLY-12286", ds_name,
303+
e.getLocalizedMessage(), error=e)
304+
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
305+
raise ex
306+
307+
240308
def __precheck_rcu_connectivity(self):
241309
_method_name = 'precheck_rcu_connectivity'
242310
self.__logger.entering(class_name=self.__class_name, method_name=_method_name)
243311

244312
domain_typename = self._model_context.get_domain_typedef().get_domain_type()
245313

246-
rcu_prefix = self._rcu_db_info.get_rcu_prefix()
247314
schema_name = None
248315
user_name = None
316+
rcu_prefix = self._rcu_db_info.get_rcu_prefix()
249317
if not string_utils.is_empty(rcu_prefix):
250318
user_name = self._model_context.get_weblogic_helper().get_stb_user_name(rcu_prefix)
251319
schema_name = user_name[len(rcu_prefix) + 1:]
@@ -324,6 +392,8 @@ def __run_rcu(self):
324392
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name)
325393
return
326394

395+
self.__logger.info("WLSDPLY-12287", class_name=self.__class_name, method_name=_method_name)
396+
327397
rcu_db_info = self._rcu_db_info
328398
oracle_home = self._model_context.get_oracle_home()
329399
java_home = self._model_context.get_java_home()
@@ -585,17 +655,23 @@ def __set_rcu_datasource_parameters_without_shadow_table(self):
585655
_method_name = '__set_rcu_datasource_parameters_without_shadow_table'
586656
self.__logger.entering(class_name=self.__class_name, method_name=_method_name)
587657

588-
tns_admin, rcu_prefix, data_source_conn_string, rcu_schema_pwd = \
589-
self.__get_rcu_datasource_basic_connection_info()
590-
keystore, keystore_type, keystore_pwd, truststore, truststore_type, truststore_pwd = \
591-
self.__get_rcu_datasource_ssl_connection_info()
592-
593658
location = LocationContext()
594659
location.append_location(JDBC_SYSTEM_RESOURCE)
595660
folder_path = self._aliases.get_wlst_list_path(location)
596661
self._wlst_helper.cd(folder_path)
597662
ds_names = self._wlst_helper.lsc()
598663

664+
if self._rcu_db_info.is_rcu_db_info_empty():
665+
self.__logger.fine("WLSDPLY-12284", class_name=self.__class_name, method_name=_method_name)
666+
self.__precheck_rcu_default_datasource_entries_for_norcu(ds_names)
667+
return ds_names
668+
669+
tns_admin, rcu_prefix, data_source_conn_string, rcu_schema_pwd = \
670+
self.__get_rcu_datasource_basic_connection_info()
671+
keystore, keystore_type, keystore_pwd, truststore, truststore_type, truststore_pwd = \
672+
self.__get_rcu_datasource_ssl_connection_info()
673+
674+
599675
rcu_database_type = self._rcu_db_info.get_rcu_database_type()
600676
jdbc_driver_class_name = self.__get_jdbc_driver_class_name(rcu_database_type)
601677

core/src/main/python/wlsdeploy/tool/validate/create_content_validator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ def __validate_rcu_db_info_section(self, info_dict):
114114
if not self._model_context.get_domain_typedef().requires_rcu():
115115
return
116116

117+
if not self._model_context.is_run_rcu() and len(info_dict) == 0:
118+
return
119+
117120
rcu_prefix = dictionary_utils.get_element(info_dict, RCU_PREFIX)
118121
if not rcu_prefix:
119122
self._logger.severe('WLSDPLY-05304', RCU_DB_INFO, RCU_PREFIX,

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,14 @@ WLSDPLY-12279=createDomain found the OPSS wallet passphrase in the model but the
18781878
WLSDPLY-12280=createDomain found the OPSS wallet passphrase in the command-line args but the OPSS wallet was not provided
18791879
WLSDPLY-12281={0} domain creation precheck failed. {1}: {2}
18801880
WLSDPLY-12282={0} domain creation precheck failed. {1}
1881+
WLSDPLY-12283=Domain has no RCUDbInfo skipping connectivity precheck.
1882+
WLSDPLY-12284=Domain has no RCUDbInfo rely on model data to set default datasource connectivity info.
1883+
WLSDPLY-12285=Domain has no RCUDbInfo but required datasource named {0} is not provided in the model.
1884+
WLSDPLY-12286=Domain has no RCUDbInfo but required datasource named {0} failed to connect to the database - {1}.
1885+
WLSDPLY-12287=Running rcu to drop and recreate the schema with '-useSamePasswordForAllSchemaUsers' using information \
1886+
in RCUDbInfo.
1887+
WLSDPLY-12288=Testing default datasource {0} connectivity.
1888+
18811889

18821890
# domain_typedef.py
18831891
WLSDPLY-12300={0} got the domain type {1} but the domain type definition file {2} was not valid: {3}

0 commit comments

Comments
 (0)