Skip to content

Commit dc81d0e

Browse files
unifying and deprecating the RCU Command-Line Args (#1438)
* unifying and deprecating the RCU Command-Line Args * fixing string type error * more issues with passwords
1 parent d173997 commit dc81d0e

File tree

6 files changed

+75
-97
lines changed

6 files changed

+75
-97
lines changed

core/src/main/python/create.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
193193
error=ioe)
194194
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
195195
raise ex
196-
optional_arg_map[CommandLineArgUtil.RCU_SYS_PASS_SWITCH] = String(password)
196+
optional_arg_map[CommandLineArgUtil.RCU_SYS_PASS_SWITCH] = str(String(password))
197197
if CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH not in optional_arg_map:
198198
try:
199199
password = getcreds.getpass('WLSDPLY-12405')
@@ -203,7 +203,7 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
203203
error=ioe)
204204
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
205205
raise ex
206-
optional_arg_map[CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH] = String(password)
206+
optional_arg_map[CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH] = str(String(password))
207207
else:
208208
ex = exception_helper.create_cla_exception(ExitCode.USAGE_ERROR,
209209
'WLSDPLY-12407', _program_name,
@@ -232,7 +232,7 @@ def __process_opss_args(optional_arg_map):
232232
'WLSDPLY-20028', ioe.getLocalizedMessage(), error=ioe)
233233
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
234234
raise ex
235-
optional_arg_map[CommandLineArgUtil.OPSS_WALLET_PASSPHRASE] = String(passphrase)
235+
optional_arg_map[CommandLineArgUtil.OPSS_WALLET_PASSPHRASE] = str(String(passphrase))
236236

237237

238238
def validate_rcu_args_and_model(model_context, model, archive_helper, aliases):

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ def __run_rcu(self):
270270
rcu_db_info = rcudbinfo_helper.create(self.model.get_model(), self.model_context, self.aliases)
271271

272272
# get these values from the command-line or RCUDbInfo in the model
273-
rcu_prefix = rcu_db_info.get_preferred_prefix()
274-
rcu_sys_pass = rcu_db_info.get_preferred_sys_pass()
275-
rcu_schema_pass = rcu_db_info.get_preferred_schema_pass()
273+
rcu_prefix = rcu_db_info.get_rcu_prefix()
274+
rcu_sys_pass = rcu_db_info.get_admin_password()
275+
rcu_schema_pass = rcu_db_info.get_rcu_schema_password()
276276

277277
database_type = rcu_db_info.get_database_type()
278278
if database_type is not None and database_type not in ['SSL', 'ATP', 'ORACLE']:
@@ -328,7 +328,7 @@ def __run_rcu(self):
328328
truststore, keystore_pwd, keystore_type, keystore = self.__validate_and_get_ssl_rcudbinfo(rcu_db_info)
329329

330330
rcu_runner_map = dict()
331-
rcu_db_user = rcu_db_info.get_preferred_db_user()
331+
rcu_db_user = rcu_db_info.get_rcu_db_user()
332332
ssl_conn_properties = dict()
333333

334334
self._set_rcu_ssl_args_properties(ssl_conn_properties, rcu_db_info, keystore, keystore_type, truststore,
@@ -343,13 +343,13 @@ def __run_rcu(self):
343343
runner.setRCUAdminUser(rcu_db_user)
344344
else:
345345
# Non-ATP database, use DB config from the command line or RCUDbInfo in the model.
346-
rcu_db = rcu_db_info.get_preferred_db()
346+
rcu_db = rcu_db_info.get_rcu_regular_db_conn()
347347

348348
if rcu_db is None:
349349
ex = exception_helper.create_create_exception('WLSDPLY-12572')
350350
raise ex
351351

352-
rcu_db_user = rcu_db_info.get_preferred_db_user()
352+
rcu_db_user = rcu_db_info.get_rcu_db_user()
353353

354354
runner = RCURunner.createRunner(domain_type, oracle_home, java_home, rcu_db, rcu_prefix, rcu_schemas,
355355
rcu_db_info.get_rcu_variables())
@@ -1050,7 +1050,7 @@ def __validate_and_get_atp_rcudbinfo(self, rcu_db_info, check_admin_pwd=False):
10501050
_method_name = '__validate_and_get_atp_rcudbinfo'
10511051

10521052
tns_admin = rcu_db_info.get_tns_admin()
1053-
rcu_database = rcu_db_info.get_preferred_db()
1053+
rcu_database = rcu_db_info.get_rcu_regular_db_conn()
10541054

10551055
if rcu_database is None:
10561056
if tns_admin is None or not os.path.exists(tns_admin + os.sep + "tnsnames.ora"):
@@ -1109,7 +1109,7 @@ def __validate_and_get_ssl_rcudbinfo(self, rcu_db_info, check_admin_pwd=False):
11091109
tns_admin = rcu_db_info.get_tns_admin()
11101110
truststore = rcu_db_info.get_truststore()
11111111

1112-
rcu_database = rcu_db_info.get_preferred_db()
1112+
rcu_database = rcu_db_info.get_rcu_regular_db_conn()
11131113
# If user specify connect string, no need to fetch from tnsnames.ora
11141114

11151115
if rcu_database is None:
@@ -1547,8 +1547,8 @@ def get_rcu_basic_connection_info(self, rcu_db_info):
15471547
truststore_pwd = None
15481548
truststore_type = None
15491549

1550-
rcu_prefix = rcu_db_info.get_preferred_prefix()
1551-
rcu_schema_pwd = rcu_db_info.get_preferred_schema_pass()
1550+
rcu_prefix = rcu_db_info.get_rcu_prefix()
1551+
rcu_schema_pwd = rcu_db_info.get_rcu_schema_password()
15521552
if rcu_prefix is None:
15531553
ex = exception_helper.create_create_exception('WLSDPLY-12413', 'rcu_prefix',
15541554
"['rcu_prefix','rcu_schema_password']")
@@ -1573,7 +1573,7 @@ def get_rcu_basic_connection_info(self, rcu_db_info):
15731573
tns_admin, rcu_database, truststore_pwd, truststore_type, \
15741574
truststore, keystore_pwd, keystore_type, keystore = self.__validate_and_get_ssl_rcudbinfo(rcu_db_info)
15751575
else:
1576-
rcu_database = rcu_db_info.get_preferred_db()
1576+
rcu_database = rcu_db_info.get_rcu_regular_db_conn()
15771577
if rcu_database is None:
15781578
ex = exception_helper.create_create_exception('WLSDPLY-12564')
15791579
raise ex

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

Lines changed: 25 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from wlsdeploy.aliases.model_constants import RCU_DEFAULT_TBLSPACE
3131
from wlsdeploy.aliases.model_constants import RCU_TEMP_TBLSPACE
3232
from wlsdeploy.util import dictionary_utils
33+
from wlsdeploy.util import string_utils
3334
from wlsdeploy.util.model_context import ModelContext
3435
from wlsdeploy.logging.platform_logger import PlatformLogger
3536

@@ -90,11 +91,17 @@ def get_tns_entry(self):
9091
return None
9192

9293
def get_rcu_prefix(self):
93-
return self._get_dictionary_element_value(RCU_PREFIX)
94+
rcu_prefix = self.model_context.get_rcu_prefix()
95+
if string_utils.is_empty(rcu_prefix):
96+
rcu_prefix = self._get_dictionary_element_value(RCU_PREFIX)
97+
return rcu_prefix
9498

9599
def get_rcu_schema_password(self):
96-
password = self._get_dictionary_element_value(RCU_SCHEMA_PASSWORD)
97-
return self.aliases.decrypt_password(password)
100+
rcu_schema_pass = self.model_context.get_rcu_schema_pass()
101+
if string_utils.is_empty(rcu_schema_pass):
102+
password = self._get_dictionary_element_value(RCU_SCHEMA_PASSWORD)
103+
rcu_schema_pass = self.aliases.decrypt_password(password)
104+
return rcu_schema_pass
98105

99106
def get_keystore(self):
100107
return self._get_dictionary_element_value(DRIVER_PARAMS_KEYSTORE_PROPERTY)
@@ -117,11 +124,17 @@ def get_truststore_password(self):
117124
return self.aliases.decrypt_password(password)
118125

119126
def get_admin_password(self):
120-
password = self._get_dictionary_element_value(RCU_ADMIN_PASSWORD)
121-
return self.aliases.decrypt_password(password)
127+
rcu_admin_pass = self.model_context.get_rcu_sys_pass()
128+
if string_utils.is_empty(rcu_admin_pass):
129+
password = self._get_dictionary_element_value(RCU_ADMIN_PASSWORD)
130+
rcu_admin_pass = self.aliases.decrypt_password(password)
131+
return rcu_admin_pass
122132

123133
def get_rcu_regular_db_conn(self):
124-
return self._get_dictionary_element_value(RCU_DB_CONN)
134+
rcu_db_conn = self.model_context.get_rcu_database()
135+
if string_utils.is_empty(rcu_db_conn):
136+
rcu_db_conn = self._get_dictionary_element_value(RCU_DB_CONN)
137+
return rcu_db_conn
125138

126139
def get_atp_default_tablespace(self):
127140
_method_name = 'get_atp_default_tablespace'
@@ -160,11 +173,15 @@ def get_atp_admin_user(self):
160173
return 'admin'
161174

162175
def get_rcu_db_user(self):
176+
cli_admin_user = self.model_context.get_rcu_db_user()
177+
if cli_admin_user != ModelContext.DB_USER_DEFAULT:
178+
return cli_admin_user
179+
163180
result = self._get_dictionary_element_value(RCU_DB_USER)
164181
if result is not None:
165182
return result
166183
else:
167-
return ModelContext.DB_USER_DEFAULT
184+
return cli_admin_user
168185

169186
def get_comp_info_location(self):
170187
result = self._get_dictionary_element_value(RCU_COMP_INFO)
@@ -197,14 +214,8 @@ def has_atpdbinfo(self):
197214
def has_ssldbinfo(self):
198215
return self.is_use_ssl()
199216

200-
def is_multidatasource(self):
201-
if self.get_multidatasource_urls() is not None and self.get_database_type() != 'AGL':
202-
return True
203-
else:
204-
return False
205-
206217
def is_regular_db(self):
207-
result = self._get_dictionary_element_value(RCU_DB_CONN)
218+
result = self.get_rcu_regular_db_conn()
208219
if result is not None:
209220
if self.get_database_type() == 'ORACLE' and not (self.is_use_atp() or self.is_use_ssl()):
210221
return True
@@ -242,56 +253,6 @@ def is_use_ssl(self):
242253
value = alias_utils.convert_to_type('boolean', model_value)
243254
return value == 'true'
244255
return self.get_database_type() == 'SSL'
245-
246-
def get_preferred_db(self):
247-
"""
248-
Return the regular db connect string from command line or model.
249-
:return: the db connect string
250-
"""
251-
cli_value = self.model_context.get_rcu_database()
252-
if cli_value is not None:
253-
return cli_value
254-
return self.get_rcu_regular_db_conn()
255-
256-
def get_preferred_db_user(self):
257-
"""
258-
Return the db user from command line or model.
259-
:return: the db user
260-
"""
261-
cli_value = self.model_context.get_rcu_db_user()
262-
if cli_value != ModelContext.DB_USER_DEFAULT:
263-
return cli_value
264-
return self.get_rcu_db_user()
265-
266-
def get_preferred_prefix(self):
267-
"""
268-
Return the prefix from command line or model.
269-
:return: the prefix
270-
"""
271-
cli_value = self.model_context.get_rcu_prefix()
272-
if cli_value is not None:
273-
return cli_value
274-
return self.get_rcu_prefix()
275-
276-
def get_preferred_schema_pass(self):
277-
"""
278-
Return the schema password from command line or model.
279-
:return: the schema password
280-
"""
281-
cli_value = self.model_context.get_rcu_schema_pass()
282-
if cli_value is not None:
283-
return cli_value
284-
return self.get_rcu_schema_password()
285-
286-
def get_preferred_sys_pass(self):
287-
"""
288-
Return the system password from command line or model.
289-
:return: the system password
290-
"""
291-
cli_value = self.model_context.get_rcu_sys_pass()
292-
if cli_value is not None:
293-
return cli_value
294-
return self.get_admin_password()
295256

296257

297258
def create(model_dictionary, model_context, aliases):

core/src/main/python/wlsdeploy/util/cla_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,22 +276,27 @@ def process_args(self, args, tool_type=TOOL_TYPE_DEFAULT, trailing_arg_count=0):
276276
value, idx = self._get_arg_value(args, idx)
277277
self._validate_rcu_database_arg(value)
278278
self._add_arg(key, value)
279+
_logger.deprecation('WLSDPLY-31000')
279280
elif self.is_rcu_dbuser_key(key):
280281
value, idx = self._get_arg_value(args, idx)
281282
self._validate_rcu_dbuser_arg(value)
282283
self._add_arg(key, value)
284+
_logger.deprecation('WLSDPLY-31001')
283285
elif self.is_rcu_prefix_key(key):
284286
value, idx = self._get_arg_value(args, idx)
285287
self._validate_rcu_prefix_arg(value)
286288
self._add_arg(key, value)
289+
_logger.deprecation('WLSDPLY-31002')
287290
elif self.is_rcu_sys_pass_key(key):
288291
value, idx = self._get_arg_value(args, idx)
289292
self._validate_rcu_sys_pass_arg(value)
290293
self._add_arg(key, value)
294+
_logger.deprecation('WLSDPLY-31003')
291295
elif self.is_rcu_schema_pass_key(key):
292296
value, idx = self._get_arg_value(args, idx)
293297
self._validate_rcu_schema_pass_arg(value)
294298
self._add_arg(key, value)
299+
_logger.deprecation('WLSDPLY-31004')
295300
elif self.is_passphrase_switch(key):
296301
value, idx = self._get_arg_value(args, idx)
297302
self._validate_passphrase_arg(value)

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,3 +1868,15 @@ WLSDPLY-30059=Failed to add the RCU wallet from {0} with overwrite value {1} to
18681868
WLSDPLY-30060=The archiveHelper remove rcuWallet command removed {0} entries from archive file {1}.
18691869
WLSDPLY-30061=Failed to remove RCU database wallet from archive file {0}: {1}.
18701870
WLSDPLY-30062=Failed to remove RCU database wallet with force value {0} from archive file {1}: {2}.
1871+
1872+
# Overflow for cla_utils.py
1873+
WLSDPLY-31000=The Create Domain tool's -rcu_db argument is deprecated and will be removed in a future release. \
1874+
Please use the rcu_db_conn_string attribute under the RCUDbInfo section of the model instead.
1875+
WLSDPLY-31001=The Create Domain tool's -rcu_db_user argument is deprecated and will be removed in a future release. \
1876+
Please use the rcu_db_user attribute under the RCUDbInfo section of the model instead.
1877+
WLSDPLY-31002=The Create Domain tool's -rcu_prefix argument is deprecated and will be removed in a future release. \
1878+
Please use the rcu_prefix attribute under the RCUDbInfo section of the model instead.
1879+
WLSDPLY-31003=The Create Domain tool's -rcu_sys_pass argument is deprecated and will be removed in a future release. \
1880+
Please use the rcu_admin_password attribute under the RCUDbInfo section of the model instead.
1881+
WLSDPLY-31004=The Create Domain tool's -rcu_schema_pass argument is deprecated and will be removed in a future release. \
1882+
Please use the rcu_schema_password attribute under the RCUDbInfo section of the model instead.

0 commit comments

Comments
 (0)