Skip to content

Commit adf6e77

Browse files
committed
Merge branch 'github-1576-2' into 'main'
fixing RCU pre-check handling of JDBC driver properties from the model See merge request weblogic-cloud/weblogic-deploy-tooling!1729
2 parents fd76a6b + 10cb536 commit adf6e77

File tree

3 files changed

+64
-6
lines changed

3 files changed

+64
-6
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
@@ -390,6 +390,7 @@
390390
DRIVER_NAME = 'DriverName'
391391
DRIVER_PARAMS_PROPERTY_VALUE = 'Value'
392392
DRIVER_PARAMS_PROPERTY_VALUE_ENCRYPTED = 'EncryptedValueEncrypted'
393+
DRIVER_PARAMS_PROPERTY_SYS_PROP_VALUE = 'SysPropValue'
393394
DRIVER_PARAMS_USER_PROPERTY = 'user'
394395
DRIVER_PARAMS_TRUSTSTORE_PROPERTY = 'javax.net.ssl.trustStore'
395396
DRIVER_PARAMS_KEYSTORE_PROPERTY = 'javax.net.ssl.keyStore'

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

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_NET_TNS_ADMIN
4444
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_PROPERTY_VALUE
4545
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_PROPERTY_VALUE_ENCRYPTED
46+
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_PROPERTY_SYS_PROP_VALUE
4647
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY
4748
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY
4849
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY
@@ -887,7 +888,55 @@ def __update_precheck_from_model_data_source(self, jdbc_driver_name, jdbc_conn_s
887888
props.put('password', new_password)
888889

889890
for prop_key, prop_value in model_properties_dict.iteritems():
890-
props.put(prop_key, prop_value)
891+
if isinstance(prop_value, dict):
892+
if DRIVER_PARAMS_PROPERTY_VALUE in prop_value:
893+
props.put(prop_key, prop_value[DRIVER_PARAMS_PROPERTY_VALUE])
894+
elif DRIVER_PARAMS_PROPERTY_SYS_PROP_VALUE in prop_value:
895+
sys_prop_name = prop_value[DRIVER_PARAMS_PROPERTY_SYS_PROP_VALUE]
896+
sys_prop_value = None
897+
if sys_prop_name is not None:
898+
sys_prop_value = System.getProperty(sys_prop_name)
899+
900+
if sys_prop_value is not None:
901+
props.put(prop_key, sys_prop_value)
902+
else:
903+
if sys_prop_name is None:
904+
self.__logger.warning('WLSDPLY-12271', data_source_name, prop_key,
905+
DRIVER_PARAMS_PROPERTY_SYS_PROP_VALUE,
906+
class_name=self.__class_name, method_name=_method_name)
907+
else:
908+
# The system property specified might be something like "weblogic.Name", which
909+
# will be set for the actual DataSource inside the server but typically won't
910+
# be set in a WDT createDomain environment so log as info instead of warning
911+
# so that createDomain doesn't exit with a non-zero exit code.
912+
#
913+
self.__logger.info('WLSDPLY-12273', data_source_name, prop_key,
914+
DRIVER_PARAMS_PROPERTY_SYS_PROP_VALUE, sys_prop_name,
915+
class_name=self.__class_name, method_name=_method_name)
916+
else:
917+
unhandled_field_name = None
918+
if DRIVER_PARAMS_PROPERTY_VALUE_ENCRYPTED in prop_value:
919+
unhandled_field_name = DRIVER_PARAMS_PROPERTY_VALUE_ENCRYPTED
920+
921+
if unhandled_field_name is not None:
922+
ex = exception_helper.create_create_exception('WLSDPLY-12265', data_source_name,
923+
prop_key, DRIVER_PARAMS_PROPERTY_VALUE,
924+
unhandled_field_name)
925+
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
926+
raise ex
927+
else:
928+
unhandled_field_names = prop_value.keys()
929+
if len(unhandled_field_names) > 0:
930+
# This should never happen since validation should catch unsupported fields
931+
unhandled_field_name = unhandled_field_names.join(',')
932+
ex = exception_helper.create_create_exception('WLSDPLY-12266', data_source_name,
933+
prop_key, DRIVER_PARAMS_PROPERTY_VALUE,
934+
unhandled_field_name)
935+
else:
936+
ex = exception_helper.create_create_exception('WLSDPLY-12267', data_source_name,
937+
prop_key, DRIVER_PARAMS_PROPERTY_VALUE)
938+
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
939+
raise ex
891940

892941
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name,
893942
result=[new_jdbc_driver_name, new_jdbc_conn_string])

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,15 +1846,23 @@ WLSDPLY-12263=Unable to retrieve database connection info, please make sure the
18461846
WLSDPLY-12264=Unable to retrieve database connection string, please make sure it is specified in \
18471847
RCUDbInfo.rcu_db_conn_string field or by using the RCUDbInfo.oracle.net.tns_admin and RCUDbInfo.tns_alias fields to \
18481848
point to the tnsnames.ora file location and tns alias entry to use.
1849-
WLSDPLY-12265=NOT USED
1850-
WLSDPLY-12266=NOT USED
1851-
WLSDPLY-12267=NOT USED
1849+
WLSDPLY-12265=During RCU pre-check, the resources section of the model contained JDBCSystemResource {0} that defined a \
1850+
JDBCDriverParams Property {1} that did not have the excepted key {2} but had the key {3} instead. This key is not \
1851+
currently handled so please raise a GitHub issue if you require support for this key type.
1852+
WLSDPLY-12266=During RCU pre-check, the resources section of the model contained JDBCSystemResource {0} that defined a \
1853+
JDBCDriverParams Property {1} that did not have the excepted key {2} but had unsupported keys [{3}] instead.
1854+
WLSDPLY-12267=During RCU pre-check, the resources section of the model contained JDBCSystemResource {0} that defined a \
1855+
JDBCDriverParams Property {1} that did not have the excepted key {2} and no other keys were provided.
18521856
WLSDPLY-12268=Creating empty folder {0}. Folder contains no attributes or sub-folders.
18531857
WLSDPLY-12269=Setting the topology profile to {0}
18541858
WLSDPLY-12270=Unable to retrieve database connection info: {0}
1855-
WLSDPLY-12271=NOT USED
1859+
WLSDPLY-12271=During RCU pre-check, the resources section of the model contained JDBCSystemResource {0} that defined a \
1860+
JDBCDriverParams Property {1} that specified the key {2} but the specified Java System Property name was not provided, \
1861+
so it is being skipped.
18561862
WLSDPLY-12272=Failed to create domain because RCUDbinfo is missing rcu_db_conn_string
1857-
WLSDPLY-12273=NOT USED
1863+
WLSDPLY-12273=During RCU pre-check, the resources section of the model contained JDBCSystemResource {0} that defined a \
1864+
JDBCDriverParams Property {1} that specified the key {2} but the specified Java System Property "{3}" had no value so \
1865+
is it is being skipped.
18581866
WLSDPLY-12274=Path {0} specified for JDBC driver property {1} does not exist. Please check your model's RCUDbInfo section.
18591867
WLSDPLY-12275=Setting rcu datasource {0} driver params - url: {1}. schema: {2}. properties: {3}.
18601868
WLSDPLY-12276=Post Create Domain Script {0} was run successfully

0 commit comments

Comments
 (0)