Skip to content

Commit b3707be

Browse files
committed
Merge branch 'jrf-create-domain-diff-pwds' into 'main'
Fix JRF domain creation not using user provided sparse datasource model See merge request weblogic-cloud/weblogic-deploy-tooling!1513
2 parents 35c6b92 + ff6cea4 commit b3707be

File tree

2 files changed

+64
-5
lines changed

2 files changed

+64
-5
lines changed

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

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
from wlsdeploy.aliases.model_constants import PASSWORD
5757
from wlsdeploy.aliases.model_constants import PASSWORD_ENCRYPTED
5858
from wlsdeploy.aliases.model_constants import PRODUCTION_MODE_ENABLED
59+
from wlsdeploy.aliases.model_constants import RESOURCES
5960
from wlsdeploy.aliases.model_constants import RCU_COMP_INFO
6061
from wlsdeploy.aliases.model_constants import RCU_DB_INFO
6162
from wlsdeploy.aliases.model_constants import RCU_STG_INFO
@@ -94,6 +95,7 @@
9495
from wlsdeploy.tool.deploy import model_deployer
9596
from wlsdeploy.tool.util.archive_helper import ArchiveHelper
9697
from wlsdeploy.tool.util.credential_map_helper import CredentialMapHelper
98+
from wlsdeploy.tool.deploy.datasource_deployer import DatasourceDeployer
9799
from wlsdeploy.tool.util.default_authenticator_helper import DefaultAuthenticatorHelper
98100
from wlsdeploy.tool.util.library_helper import LibraryHelper
99101
from wlsdeploy.tool.util.saml2_security_helper import Saml2SecurityHelper
@@ -105,6 +107,8 @@
105107
from wlsdeploy.util import model
106108
from wlsdeploy.util import model_helper
107109
from wlsdeploy.util import string_utils
110+
from wlsdeploy.aliases.wlst_modes import WlstModes
111+
108112
import wlsdeploy.util.unicode_helper as str_helper
109113

110114
class DomainCreator(Creator):
@@ -154,7 +158,7 @@ def __init__(self, model_dictionary, model_context, aliases):
154158

155159
self.__default_domain_name = None
156160
self.__default_admin_server_name = None
157-
161+
self.__fmw_template_default_data_sources_names = None
158162
archive_file_name = self.model_context.get_archive_file_name()
159163
if archive_file_name is not None:
160164
self.archive_helper = ArchiveHelper(archive_file_name, self._domain_home, self.logger,
@@ -732,9 +736,30 @@ def __apply_base_domain_config(self, topology_folder_list, delete=True):
732736

733737
self.__create_other_domain_artifacts(location, topology_local_list)
734738

739+
if self.__fmw_template_default_data_sources_names:
740+
self._reset_fmw_template_data_source_defaults_from_model()
741+
735742
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
736743
return
737744

745+
def _reset_fmw_template_data_source_defaults_from_model(self):
746+
# Go through the model to find any FMW data sources to override the defaults
747+
# from users's model before the first writeDomain.
748+
resources_dict = self.model.get_model_resources()
749+
if JDBC_SYSTEM_RESOURCE in resources_dict:
750+
fmw_resources = {RESOURCES: {JDBC_SYSTEM_RESOURCE: {}}}
751+
fmw_jdbc_resources = fmw_resources[RESOURCES][JDBC_SYSTEM_RESOURCE]
752+
ds_dict = resources_dict[JDBC_SYSTEM_RESOURCE]
753+
for ds_name in ds_dict:
754+
fmw_ds = ds_dict[ds_name]
755+
if ds_name in self.__fmw_template_default_data_sources_names:
756+
fmw_jdbc_resources[ds_name] = fmw_ds
757+
if len(fmw_resources[RESOURCES][JDBC_SYSTEM_RESOURCE]) != 0:
758+
ds_location = LocationContext()
759+
data_source_deployer = DatasourceDeployer(self.model, self.model_context, self.aliases,
760+
WlstModes.OFFLINE)
761+
data_source_deployer.add_data_sources(fmw_resources[RESOURCES], ds_location)
762+
738763
def __set_core_domain_params(self):
739764
"""
740765
Set the core domain parameters.
@@ -1192,9 +1217,9 @@ def __set_rcu_datasource_parameters_without_shadow_table(self, rcu_db_info):
11921217
folder_path = self.aliases.get_wlst_list_path(location)
11931218
self.wlst_helper.cd(folder_path)
11941219
ds_names = self.wlst_helper.lsc()
1220+
self.__fmw_template_default_data_sources_names = ds_names
11951221

11961222
for ds_name in ds_names:
1197-
11981223
# Set the driver params
11991224
actual_url = self.__set_datasource_url(ds_name, fmw_database)
12001225
self.__set_datasource_password(ds_name, rcu_schema_pwd)
@@ -1210,6 +1235,7 @@ def __set_rcu_datasource_parameters_without_shadow_table(self, rcu_db_info):
12101235
self.logger.info('WLSDPLY_12575', ds_name, actual_url, actual_schema, pset,
12111236
class_name=self.__class_name, method_name=_method_name)
12121237

1238+
12131239
def __reset_datasource_template_userid(self, datasource_name, rcu_prefix):
12141240
location = deployer_utils.get_jdbc_driver_params_location(datasource_name, self.aliases)
12151241
location.append_location(JDBC_DRIVER_PARAMS_PROPERTIES)

documentation/3.0/content/userguide/database/connect-db.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,45 @@ In the following examples of the JRF data source sparse model, you can use it to
251251

252252
#### Default template data source
253253

254-
This is a sparse model for JRF data sources with the RCU prefix `FMW1`.
255-
You will need to update at least the `URL`, `PasswordEncrypted`, and the `user` property value. When you specify the value of `URL`, it
256-
must be a valid `JDBC URL` format, which is different from the `rcu_db_conn_string` which does not require the `jdbc:oracle:thin:...` part.
254+
For example, if you have created RCU schemas with different passwords for different schemas. You can use a sparse model to create a domain with different passwords for different FMW data sources.
257255

258256
```yaml
257+
domainInfo:
258+
RCUDbInfo:
259+
rcu_prefix : -- FIX ME --
260+
rcu_schema_password : -- FIX ME --
261+
rcu_db_conn_string : -- FIX ME --
259262
resources:
263+
JDBCSystemResource:
264+
LocalSvcTblDataSource:
265+
JdbcResource:
266+
JDBCDriverParams:
267+
PasswordEncrypted: --FIX ME--
268+
opss-data-source:
269+
JdbcResource:
270+
JDBCDriverParams:
271+
PasswordEncrypted: --FIX ME--
272+
opss-audit-viewDS:
273+
JdbcResource:
274+
JDBCDriverParams:
275+
PasswordEncrypted: --FIX ME--
276+
opss-audit-DBDS:
277+
JdbcResource:
278+
JDBCDriverParams:
279+
PasswordEncrypted: --FIX ME--
280+
mds-owsm:
281+
JdbcResource:
282+
JDBCDriverParams:
283+
PasswordEncrypted: --FIX ME--
284+
```
285+
286+
This is a sparse model of the FMW data sources discovered from a FMW domain. You can use any part of it to update your domain.
287+
288+
```yaml
289+
290+
...
291+
292+
resources:
260293
JDBCSystemResource:
261294
WLSSchemaDataSource:
262295
JdbcResource:

0 commit comments

Comments
 (0)