Skip to content

Commit ea9b282

Browse files
committed
adding validation of required RCUDbInfo section attributes
1 parent 9a6368b commit ea9b282

File tree

6 files changed

+56
-28
lines changed

6 files changed

+56
-28
lines changed

core/src/main/java/oracle/weblogic/deploy/create/RCURunner.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public void runRcu(String rcuSysPass, String rcuSchemaPass, boolean disableRcuDr
244244
File rcuScript = FileUtils.getCanonicalFile(new File(rcuBinDir, RCU_SCRIPT_NAME));
245245

246246
validateExistingExecutableFile(rcuScript, RCU_SCRIPT_NAME);
247-
validateNonEmptyString(rcuSysPass, "rcu_sys_password", true);
247+
validateNonEmptyString(rcuSysPass, "rcu_admin_password", true);
248248
validateNonEmptyString(rcuSchemaPass, "rcu_schema_password", true);
249249

250250
if (!disableRcuDropSchema) {

core/src/main/python/create.py

+42-19
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
# imports from local packages start here
2828
from wlsdeploy.aliases.aliases import Aliases
2929
from wlsdeploy.aliases import model_constants
30-
from wlsdeploy.aliases.model_constants import DEFAULT_WLS_DOMAIN_NAME
30+
from wlsdeploy.aliases.model_constants import DEFAULT_WLS_DOMAIN_NAME, PATH_TO_RCU_ADMIN_PASSWORD, \
31+
PATH_TO_RCU_SCHEMA_PASSWORD
3132
from wlsdeploy.aliases.model_constants import DOMAIN_NAME
3233
from wlsdeploy.aliases.model_constants import PATH_TO_RCU_DB_CONN
3334
from wlsdeploy.aliases.model_constants import PATH_TO_RCU_PREFIX
@@ -47,6 +48,7 @@
4748
from wlsdeploy.util import dictionary_utils
4849
from wlsdeploy.util import env_helper
4950
from wlsdeploy.util import getcreds
51+
from wlsdeploy.util import string_utils
5052
from wlsdeploy.util import tool_main
5153
from wlsdeploy.util.cla_utils import CommandLineArgUtil
5254
from wlsdeploy.util.cla_utils import TOOL_TYPE_CREATE
@@ -204,22 +206,44 @@ def validate_rcu_args_and_model(model_context, model, archive_helper, aliases):
204206

205207
domain_info = dictionary_utils.get_dictionary_element(model, model_constants.DOMAIN_INFO)
206208

207-
if model_constants.RCU_DB_INFO in domain_info:
208-
rcu_info = domain_info[model_constants.RCU_DB_INFO]
209-
rcu_db_info = RcuDbInfo(model_context, aliases, rcu_info)
210-
has_tns_admin = rcu_db_info.has_tns_admin()
211-
is_regular_db = rcu_db_info.is_regular_db()
212-
has_atpdbinfo = rcu_db_info.has_atpdbinfo()
213-
has_ssldbinfo = rcu_db_info.has_ssldbinfo()
214-
215-
_validate_atp_wallet_in_archive(archive_helper, is_regular_db, has_tns_admin, model)
216-
elif model_context.get_domain_typedef().requires_rcu():
217-
__logger.severe('WLSDPLY-12408', model_context.get_domain_type(), PATH_TO_RCU_DB_CONN,
218-
PATH_TO_RCU_PREFIX, class_name=_class_name, method_name=_method_name)
219-
ex = exception_helper.create_create_exception('WLSDPLY-12408', model_context.get_domain_type(),
220-
PATH_TO_RCU_DB_CONN, PATH_TO_RCU_PREFIX)
221-
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
222-
raise ex
209+
if model_context.get_domain_typedef().requires_rcu():
210+
if model_constants.RCU_DB_INFO in domain_info:
211+
rcu_info = domain_info[model_constants.RCU_DB_INFO]
212+
rcu_db_info = RcuDbInfo(model_context, aliases, rcu_info)
213+
214+
if string_utils.is_empty(rcu_db_info.get_rcu_prefix()):
215+
ex = exception_helper.create_validate_exception('WLSDPLY-12414', model_context.get_domain_type(),
216+
PATH_TO_RCU_PREFIX)
217+
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
218+
raise ex
219+
#
220+
# Skip validating rcu_db_conn since is there is a tnsnames.ora file,
221+
# the connection string is picked up from there.
222+
#
223+
if string_utils.is_empty(rcu_db_info.get_rcu_schema_password()):
224+
ex = exception_helper.create_validate_exception('WLSDPLY-12414', model_context.get_domain_type(),
225+
PATH_TO_RCU_SCHEMA_PASSWORD)
226+
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
227+
raise ex
228+
229+
if model_context.is_run_rcu() and string_utils.is_empty(rcu_db_info.get_rcu_admin_password()):
230+
ex = exception_helper.create_validate_exception('WLSDPLY-12415', model_context.get_domain_type(),
231+
CommandLineArgUtil.RUN_RCU_SWITCH, PATH_TO_RCU_ADMIN_PASSWORD)
232+
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
233+
raise ex
234+
235+
has_tns_admin = rcu_db_info.has_tns_admin()
236+
is_regular_db = rcu_db_info.is_regular_db()
237+
has_atpdbinfo = rcu_db_info.has_atpdbinfo()
238+
has_ssldbinfo = rcu_db_info.has_ssldbinfo()
239+
240+
_validate_atp_wallet_in_archive(archive_helper, is_regular_db, has_tns_admin, model)
241+
else:
242+
ex = exception_helper.create_validate_exception('WLSDPLY-12408', model_context.get_domain_type(),
243+
PATH_TO_RCU_DB_CONN, PATH_TO_RCU_PREFIX,
244+
PATH_TO_RCU_ADMIN_PASSWORD, PATH_TO_RCU_SCHEMA_PASSWORD)
245+
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
246+
raise ex
223247

224248
return has_atpdbinfo, has_ssldbinfo
225249

@@ -237,8 +261,7 @@ def _validate_atp_wallet_in_archive(archive_helper, is_regular_db, has_tns_admin
237261
model[model_constants.DOMAIN_INFO][model_constants.RCU_DB_INFO][
238262
model_constants.DRIVER_PARAMS_NET_TNS_ADMIN] = wallet_path
239263
else:
240-
__logger.severe('WLSDPLY-12411', class_name=_class_name, method_name=_method_name)
241-
ex = exception_helper.create_create_exception('WLSDPLY-12411')
264+
ex = exception_helper.create_validate_exception('WLSDPLY-12411')
242265
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
243266
raise ex
244267

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

+2
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,5 @@
471471
# Model Path constants
472472
PATH_TO_RCU_DB_CONN = '%s:/%s/%s' % (DOMAIN_INFO, RCU_DB_INFO, RCU_DB_CONN)
473473
PATH_TO_RCU_PREFIX = '%s:/%s/%s' % (DOMAIN_INFO, RCU_DB_INFO, RCU_PREFIX)
474+
PATH_TO_RCU_ADMIN_PASSWORD = '%s:/%s/%s' % (DOMAIN_INFO, RCU_DB_INFO, RCU_ADMIN_PASSWORD)
475+
PATH_TO_RCU_SCHEMA_PASSWORD = '%s:/%s/%s' % (DOMAIN_INFO, RCU_DB_INFO, RCU_SCHEMA_PASSWORD)

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

+4-7
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ def get_atp_default_tablespace(self):
152152
self._logger.deprecation('WLSDPLY-22000', ATP_DEFAULT_TABLESPACE, RCU_DEFAULT_TABLESPACE,
153153
class_name=_class_name, method_name=_method_name)
154154
return result
155-
elif self.get_rcu_default_tablespace() is not None:
156-
return self.get_rcu_default_tablespace()
157155
else:
158156
return self.get_rcu_default_tablespace()
159157

@@ -193,11 +191,10 @@ def get_storage_location(self):
193191
return None
194192

195193
def get_rcu_variables(self):
196-
result = self._get_dictionary_element_value(RCU_VARIABLES)
197-
if result is not None:
198-
return result
199-
else:
200-
return None
194+
return self._get_dictionary_element_value(RCU_VARIABLES)
195+
196+
def get_rcu_admin_password(self):
197+
return self._get_dictionary_element_value(RCU_ADMIN_PASSWORD)
201198

202199
# has_tns_admin is used to find the extract location if it is already extracted by the user
203200
# its an optional field, so insufficient to determine whether it has atp

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -1723,14 +1723,16 @@ WLSDPLY-12404=<EMPTY>
17231723
WLSDPLY-12405=<EMPTY>
17241724
WLSDPLY-12406=<EMPTY>
17251725
WLSDPLY-12407=<EMPTY>
1726-
WLSDPLY-12408=Domain type {0} definition has RCU schemas defined so the {1} and {2} model attributes are required
1726+
WLSDPLY-12408=Domain type {0} definition has RCU schemas defined so the {1}, {2}, {3}, and {4} model attributes are required
17271727
WLSDPLY-12409={0} failed to create the domain: {1}
17281728
WLSDPLY-12410={0} failed to deploy the resources and applications to the domain: {1}
17291729
WLSDPLY-12411=The model file specified ATP database info without oracle.net.tns_admin directory but the archive does \
17301730
not have wallet included
17311731
WLSDPLY-12412=The model file specified ATP database info without oracle.net.tns_admin directory and there is no \
17321732
archive specified
17331733
WLSDPLY-12413=The model file specified RCUDbInfo section but key {0} is None or missing. Required keys are {1}
1734+
WLSDPLY-12414=Domain type {0} definition has RCU schemas defined so the {1} model attribute is required
1735+
WLSDPLY-12415=Domain type {0} definition has RCU schemas defined and the {1} argument was specified so the {2} model attribute is required
17341736

17351737
# wlsroles_helper.py
17361738
WLSDPLY-12500=The WebLogic role mapper will be updated with the roles: {0}

documentation/4.0/content/release-notes/_index.md

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pre = "<b> </b>"
4646
- #1613 - Added ability to use variable tokens in the SAML 2 data initialization property files that will be replaced
4747
during domain creation or update processing.
4848
- #1614 - Updated Discover Domain Tool to overwrite existing variable and archive files if they already exist.
49+
- #1616 - Improved `RCUDbInfo` validation in Create Domain tool.
4950

5051
#### Bug Fixes
5152
- #1555 - Fixed issues with creating and discovering `UnixMachine` objects in online mode.
@@ -60,6 +61,9 @@ pre = "<b> </b>"
6061
- #1608 - Fixed a bug in creating Security groups that are members of another group.
6162
- #1610 - Fixed a bug where the Create Domain and Update Domain Tools were trying to create a security provider that
6263
is not valid in the current WebLogic Server version.
64+
- #1615 - Fixed an issue where certain errors during online update or deploy operations could leave a pending edit
65+
state that caused subsequent invocations to fail due to the pending edit state.
66+
6367
#### Known Issues
6468
None
6569

0 commit comments

Comments
 (0)