Skip to content

unifying and deprecating the RCU Command-Line Args #1438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/src/main/python/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
error=ioe)
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
raise ex
optional_arg_map[CommandLineArgUtil.RCU_SYS_PASS_SWITCH] = String(password)
optional_arg_map[CommandLineArgUtil.RCU_SYS_PASS_SWITCH] = str(String(password))
if CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH not in optional_arg_map:
try:
password = getcreds.getpass('WLSDPLY-12405')
Expand All @@ -203,7 +203,7 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
error=ioe)
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
raise ex
optional_arg_map[CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH] = String(password)
optional_arg_map[CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH] = str(String(password))
else:
ex = exception_helper.create_cla_exception(ExitCode.USAGE_ERROR,
'WLSDPLY-12407', _program_name,
Expand Down Expand Up @@ -232,7 +232,7 @@ def __process_opss_args(optional_arg_map):
'WLSDPLY-20028', ioe.getLocalizedMessage(), error=ioe)
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
raise ex
optional_arg_map[CommandLineArgUtil.OPSS_WALLET_PASSPHRASE] = String(passphrase)
optional_arg_map[CommandLineArgUtil.OPSS_WALLET_PASSPHRASE] = str(String(passphrase))


def validate_rcu_args_and_model(model_context, model, archive_helper, aliases):
Expand Down
22 changes: 11 additions & 11 deletions core/src/main/python/wlsdeploy/tool/create/domain_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ def __run_rcu(self):
rcu_db_info = rcudbinfo_helper.create(self.model.get_model(), self.model_context, self.aliases)

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

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

rcu_runner_map = dict()
rcu_db_user = rcu_db_info.get_preferred_db_user()
rcu_db_user = rcu_db_info.get_rcu_db_user()
ssl_conn_properties = dict()

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

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

rcu_db_user = rcu_db_info.get_preferred_db_user()
rcu_db_user = rcu_db_info.get_rcu_db_user()

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

tns_admin = rcu_db_info.get_tns_admin()
rcu_database = rcu_db_info.get_preferred_db()
rcu_database = rcu_db_info.get_rcu_regular_db_conn()

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

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

if rcu_database is None:
Expand Down Expand Up @@ -1547,8 +1547,8 @@ def get_rcu_basic_connection_info(self, rcu_db_info):
truststore_pwd = None
truststore_type = None

rcu_prefix = rcu_db_info.get_preferred_prefix()
rcu_schema_pwd = rcu_db_info.get_preferred_schema_pass()
rcu_prefix = rcu_db_info.get_rcu_prefix()
rcu_schema_pwd = rcu_db_info.get_rcu_schema_password()
if rcu_prefix is None:
ex = exception_helper.create_create_exception('WLSDPLY-12413', 'rcu_prefix',
"['rcu_prefix','rcu_schema_password']")
Expand All @@ -1573,7 +1573,7 @@ def get_rcu_basic_connection_info(self, rcu_db_info):
tns_admin, rcu_database, truststore_pwd, truststore_type, \
truststore, keystore_pwd, keystore_type, keystore = self.__validate_and_get_ssl_rcudbinfo(rcu_db_info)
else:
rcu_database = rcu_db_info.get_preferred_db()
rcu_database = rcu_db_info.get_rcu_regular_db_conn()
if rcu_database is None:
ex = exception_helper.create_create_exception('WLSDPLY-12564')
raise ex
Expand Down
89 changes: 25 additions & 64 deletions core/src/main/python/wlsdeploy/tool/create/rcudbinfo_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from wlsdeploy.aliases.model_constants import RCU_DEFAULT_TBLSPACE
from wlsdeploy.aliases.model_constants import RCU_TEMP_TBLSPACE
from wlsdeploy.util import dictionary_utils
from wlsdeploy.util import string_utils
from wlsdeploy.util.model_context import ModelContext
from wlsdeploy.logging.platform_logger import PlatformLogger

Expand Down Expand Up @@ -90,11 +91,17 @@ def get_tns_entry(self):
return None

def get_rcu_prefix(self):
return self._get_dictionary_element_value(RCU_PREFIX)
rcu_prefix = self.model_context.get_rcu_prefix()
if string_utils.is_empty(rcu_prefix):
rcu_prefix = self._get_dictionary_element_value(RCU_PREFIX)
return rcu_prefix

def get_rcu_schema_password(self):
password = self._get_dictionary_element_value(RCU_SCHEMA_PASSWORD)
return self.aliases.decrypt_password(password)
rcu_schema_pass = self.model_context.get_rcu_schema_pass()
if string_utils.is_empty(rcu_schema_pass):
password = self._get_dictionary_element_value(RCU_SCHEMA_PASSWORD)
rcu_schema_pass = self.aliases.decrypt_password(password)
return rcu_schema_pass

def get_keystore(self):
return self._get_dictionary_element_value(DRIVER_PARAMS_KEYSTORE_PROPERTY)
Expand All @@ -117,11 +124,17 @@ def get_truststore_password(self):
return self.aliases.decrypt_password(password)

def get_admin_password(self):
password = self._get_dictionary_element_value(RCU_ADMIN_PASSWORD)
return self.aliases.decrypt_password(password)
rcu_admin_pass = self.model_context.get_rcu_sys_pass()
if string_utils.is_empty(rcu_admin_pass):
password = self._get_dictionary_element_value(RCU_ADMIN_PASSWORD)
rcu_admin_pass = self.aliases.decrypt_password(password)
return rcu_admin_pass

def get_rcu_regular_db_conn(self):
return self._get_dictionary_element_value(RCU_DB_CONN)
rcu_db_conn = self.model_context.get_rcu_database()
if string_utils.is_empty(rcu_db_conn):
rcu_db_conn = self._get_dictionary_element_value(RCU_DB_CONN)
return rcu_db_conn

def get_atp_default_tablespace(self):
_method_name = 'get_atp_default_tablespace'
Expand Down Expand Up @@ -160,11 +173,15 @@ def get_atp_admin_user(self):
return 'admin'

def get_rcu_db_user(self):
cli_admin_user = self.model_context.get_rcu_db_user()
if cli_admin_user != ModelContext.DB_USER_DEFAULT:
return cli_admin_user

result = self._get_dictionary_element_value(RCU_DB_USER)
if result is not None:
return result
else:
return ModelContext.DB_USER_DEFAULT
return cli_admin_user

def get_comp_info_location(self):
result = self._get_dictionary_element_value(RCU_COMP_INFO)
Expand Down Expand Up @@ -197,14 +214,8 @@ def has_atpdbinfo(self):
def has_ssldbinfo(self):
return self.is_use_ssl()

def is_multidatasource(self):
if self.get_multidatasource_urls() is not None and self.get_database_type() != 'AGL':
return True
else:
return False

def is_regular_db(self):
result = self._get_dictionary_element_value(RCU_DB_CONN)
result = self.get_rcu_regular_db_conn()
if result is not None:
if self.get_database_type() == 'ORACLE' and not (self.is_use_atp() or self.is_use_ssl()):
return True
Expand Down Expand Up @@ -242,56 +253,6 @@ def is_use_ssl(self):
value = alias_utils.convert_to_type('boolean', model_value)
return value == 'true'
return self.get_database_type() == 'SSL'

def get_preferred_db(self):
"""
Return the regular db connect string from command line or model.
:return: the db connect string
"""
cli_value = self.model_context.get_rcu_database()
if cli_value is not None:
return cli_value
return self.get_rcu_regular_db_conn()

def get_preferred_db_user(self):
"""
Return the db user from command line or model.
:return: the db user
"""
cli_value = self.model_context.get_rcu_db_user()
if cli_value != ModelContext.DB_USER_DEFAULT:
return cli_value
return self.get_rcu_db_user()

def get_preferred_prefix(self):
"""
Return the prefix from command line or model.
:return: the prefix
"""
cli_value = self.model_context.get_rcu_prefix()
if cli_value is not None:
return cli_value
return self.get_rcu_prefix()

def get_preferred_schema_pass(self):
"""
Return the schema password from command line or model.
:return: the schema password
"""
cli_value = self.model_context.get_rcu_schema_pass()
if cli_value is not None:
return cli_value
return self.get_rcu_schema_password()

def get_preferred_sys_pass(self):
"""
Return the system password from command line or model.
:return: the system password
"""
cli_value = self.model_context.get_rcu_sys_pass()
if cli_value is not None:
return cli_value
return self.get_admin_password()


def create(model_dictionary, model_context, aliases):
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/python/wlsdeploy/util/cla_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,22 +276,27 @@ def process_args(self, args, tool_type=TOOL_TYPE_DEFAULT, trailing_arg_count=0):
value, idx = self._get_arg_value(args, idx)
self._validate_rcu_database_arg(value)
self._add_arg(key, value)
_logger.deprecation('WLSDPLY-31000')
elif self.is_rcu_dbuser_key(key):
value, idx = self._get_arg_value(args, idx)
self._validate_rcu_dbuser_arg(value)
self._add_arg(key, value)
_logger.deprecation('WLSDPLY-31001')
elif self.is_rcu_prefix_key(key):
value, idx = self._get_arg_value(args, idx)
self._validate_rcu_prefix_arg(value)
self._add_arg(key, value)
_logger.deprecation('WLSDPLY-31002')
elif self.is_rcu_sys_pass_key(key):
value, idx = self._get_arg_value(args, idx)
self._validate_rcu_sys_pass_arg(value)
self._add_arg(key, value)
_logger.deprecation('WLSDPLY-31003')
elif self.is_rcu_schema_pass_key(key):
value, idx = self._get_arg_value(args, idx)
self._validate_rcu_schema_pass_arg(value)
self._add_arg(key, value)
_logger.deprecation('WLSDPLY-31004')
elif self.is_passphrase_switch(key):
value, idx = self._get_arg_value(args, idx)
self._validate_passphrase_arg(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1868,3 +1868,15 @@ WLSDPLY-30059=Failed to add the RCU wallet from {0} with overwrite value {1} to
WLSDPLY-30060=The archiveHelper remove rcuWallet command removed {0} entries from archive file {1}.
WLSDPLY-30061=Failed to remove RCU database wallet from archive file {0}: {1}.
WLSDPLY-30062=Failed to remove RCU database wallet with force value {0} from archive file {1}: {2}.

# Overflow for cla_utils.py
WLSDPLY-31000=The Create Domain tool's -rcu_db argument is deprecated and will be removed in a future release. \
Please use the rcu_db_conn_string attribute under the RCUDbInfo section of the model instead.
WLSDPLY-31001=The Create Domain tool's -rcu_db_user argument is deprecated and will be removed in a future release. \
Please use the rcu_db_user attribute under the RCUDbInfo section of the model instead.
WLSDPLY-31002=The Create Domain tool's -rcu_prefix argument is deprecated and will be removed in a future release. \
Please use the rcu_prefix attribute under the RCUDbInfo section of the model instead.
WLSDPLY-31003=The Create Domain tool's -rcu_sys_pass argument is deprecated and will be removed in a future release. \
Please use the rcu_admin_password attribute under the RCUDbInfo section of the model instead.
WLSDPLY-31004=The Create Domain tool's -rcu_schema_pass argument is deprecated and will be removed in a future release. \
Please use the rcu_schema_password attribute under the RCUDbInfo section of the model instead.
Loading