48
48
from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY
49
49
from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY
50
50
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
51
53
from wlsdeploy .aliases .model_constants import JDBC_DRIVER_PARAMS
52
54
from wlsdeploy .aliases .model_constants import JDBC_DRIVER_PARAMS_PROPERTIES
53
55
from wlsdeploy .aliases .model_constants import JDBC_RESOURCE
@@ -105,19 +107,24 @@ def __init__(self, model_object, archive_helper, model_context, aliases, excepti
105
107
####################
106
108
107
109
def check_or_run_rcu (self ):
110
+
111
+ _method_name = 'check_or_run_rcu'
112
+
108
113
# This squelches the following error during JRF domain creation with an ATP database.
109
114
#
110
115
# ####<Mar 29, 2024 3:19:53 PM> <SEVERE> <FanManager> <configure> <> <attempt to configure
111
116
# ONS in FanManager failed with oracle.ons.NoServersAvailable: Subscription time out>
112
117
#
118
+
113
119
if self ._rcu_db_info .is_use_atp ():
114
120
System .setProperty ('oracle.jdbc.fanEnabled' , 'false' )
115
121
116
122
if self ._model_context .get_domain_typedef ().requires_rcu ():
117
123
if self ._model_context .is_run_rcu ():
118
124
self .__run_rcu ()
119
125
else :
120
- self .__precheck_rcu_connectivity ()
126
+ if not self ._rcu_db_info .is_rcu_db_info_empty ():
127
+ self .__precheck_rcu_connectivity ()
121
128
122
129
def configure_fmw_infra_database (self ):
123
130
"""
@@ -128,7 +135,6 @@ def configure_fmw_infra_database(self):
128
135
_method_name = 'configure_fmw_infra_database'
129
136
self .__logger .entering (class_name = self .__class_name , method_name = _method_name )
130
137
131
- # only continue with RCU configuration for domain type that requires RCU.
132
138
if not self ._domain_typedef .requires_rcu ():
133
139
self .__logger .finer ('WLSDPLY-12249' , class_name = self .__class_name , method_name = _method_name )
134
140
return
@@ -237,15 +243,77 @@ def fix_jps_config(self):
237
243
# PRIVATE METHODS
238
244
####################
239
245
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
+
240
308
def __precheck_rcu_connectivity (self ):
241
309
_method_name = 'precheck_rcu_connectivity'
242
310
self .__logger .entering (class_name = self .__class_name , method_name = _method_name )
243
311
244
312
domain_typename = self ._model_context .get_domain_typedef ().get_domain_type ()
245
313
246
- rcu_prefix = self ._rcu_db_info .get_rcu_prefix ()
247
314
schema_name = None
248
315
user_name = None
316
+ rcu_prefix = self ._rcu_db_info .get_rcu_prefix ()
249
317
if not string_utils .is_empty (rcu_prefix ):
250
318
user_name = self ._model_context .get_weblogic_helper ().get_stb_user_name (rcu_prefix )
251
319
schema_name = user_name [len (rcu_prefix ) + 1 :]
@@ -324,6 +392,8 @@ def __run_rcu(self):
324
392
self .__logger .exiting (class_name = self .__class_name , method_name = _method_name )
325
393
return
326
394
395
+ self .__logger .info ("WLSDPLY-12287" , class_name = self .__class_name , method_name = _method_name )
396
+
327
397
rcu_db_info = self ._rcu_db_info
328
398
oracle_home = self ._model_context .get_oracle_home ()
329
399
java_home = self ._model_context .get_java_home ()
@@ -585,17 +655,23 @@ def __set_rcu_datasource_parameters_without_shadow_table(self):
585
655
_method_name = '__set_rcu_datasource_parameters_without_shadow_table'
586
656
self .__logger .entering (class_name = self .__class_name , method_name = _method_name )
587
657
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
-
593
658
location = LocationContext ()
594
659
location .append_location (JDBC_SYSTEM_RESOURCE )
595
660
folder_path = self ._aliases .get_wlst_list_path (location )
596
661
self ._wlst_helper .cd (folder_path )
597
662
ds_names = self ._wlst_helper .lsc ()
598
663
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
+
599
675
rcu_database_type = self ._rcu_db_info .get_rcu_database_type ()
600
676
jdbc_driver_class_name = self .__get_jdbc_driver_class_name (rcu_database_type )
601
677
0 commit comments