2727
2828from wlsdeploy .aliases .aliases import Aliases
2929from wlsdeploy .aliases import model_constants
30+ from wlsdeploy .aliases .model_constants import DEFAULT_WLS_DOMAIN_NAME
31+ from wlsdeploy .aliases .model_constants import DOMAIN_NAME
32+ from wlsdeploy .aliases .model_constants import TOPOLOGY
3033from wlsdeploy .aliases .wlst_modes import WlstModes
3134from wlsdeploy .exception import exception_helper
3235from wlsdeploy .exception .expection_types import ExceptionType
3740from wlsdeploy .tool .create .domain_typedef import CREATE_DOMAIN
3841from wlsdeploy .tool .util import filter_helper
3942from wlsdeploy .tool .util .alias_helper import AliasHelper
43+ from wlsdeploy .tool .util .archive_helper import ArchiveHelper
4044from wlsdeploy .tool .validate .validator import Validator
4145from wlsdeploy .util import cla_helper
4246from wlsdeploy .util import getcreds
@@ -289,7 +293,6 @@ def __process_opss_args(optional_arg_map):
289293 return
290294
291295
292-
293296def validate_model (model_dictionary , model_context , aliases ):
294297 _method_name = 'validate_model'
295298
@@ -311,7 +314,9 @@ def validate_model(model_dictionary, model_context, aliases):
311314 tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
312315
313316
314- def validateRCUArgsAndModel (model_context , model , alias_helper ):
317+ def validate_rcu_args_and_model (model_context , model , archive_helper , alias_helper ):
318+ _method_name = 'validate_rcu_args_and_model'
319+
315320 has_atpdbinfo = 0
316321 domain_info = model [model_constants .DOMAIN_INFO ]
317322 if domain_info is not None :
@@ -321,26 +326,20 @@ def validateRCUArgsAndModel(model_context, model, alias_helper):
321326 has_regular_db = rcu_db_info .is_regular_db ()
322327 has_atpdbinfo = rcu_db_info .has_atpdbinfo ()
323328
324- if model_context . get_archive_file_name () and not has_regular_db :
329+ if archive_helper and not has_regular_db :
325330 System .setProperty ('oracle.jdbc.fanEnabled' , 'false' )
326331
327332 # 1. If it does not have the oracle.net.tns_admin specified, then extract to domain/atpwallet
328333 # 2. If it is plain old regular oracle db, do nothing
329334 # 3. If it deos not have tns_admin in the model, then the wallet must be in the archive
330335 if not has_tns_admin :
331- # extract the wallet first
332- archive_file = WLSDeployArchive (model_context .get_archive_file_name ())
333- atp_wallet_zipentry = None
334- if archive_file :
335- atp_wallet_zipentry = archive_file .getATPWallet ()
336- if atp_wallet_zipentry and model [model_constants .TOPOLOGY ]['Name' ]:
337- extract_path = atp_helper .extract_walletzip (model , model_context , archive_file , atp_wallet_zipentry )
336+ wallet_path = archive_helper .extract_atp_wallet ()
337+ if wallet_path :
338338 # update the model to add the tns_admin
339339 model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
340- model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ] = extract_path
340+ model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ] = wallet_path
341341 else :
342- __logger .severe ('WLSDPLY-12411' , error = None ,
343- class_name = _class_name , method_name = "validateRCUArgsAndModel" )
342+ __logger .severe ('WLSDPLY-12411' , error = None , class_name = _class_name , method_name = _method_name )
344343 cla_helper .clean_up_temp_files ()
345344 tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
346345
@@ -355,6 +354,22 @@ def validateRCUArgsAndModel(model_context, model, alias_helper):
355354 return has_atpdbinfo
356355
357356
357+ def _get_domain_path (model_context , model ):
358+ """
359+ Returns the domain home path.
360+ :param model_context: the model context
361+ :param model: the model
362+ :return: the domain path
363+ """
364+ domain_parent = model_context .get_domain_parent_dir ()
365+ if domain_parent is None :
366+ return model_context .get_domain_home ()
367+ elif TOPOLOGY in model and DOMAIN_NAME in model [TOPOLOGY ]:
368+ return domain_parent + os .sep + model [TOPOLOGY ][DOMAIN_NAME ]
369+ else :
370+ return domain_parent + os .sep + DEFAULT_WLS_DOMAIN_NAME
371+
372+
358373def main (args ):
359374 """
360375 The entry point for the create domain tool.
@@ -419,18 +434,20 @@ def main(args):
419434 if filter_helper .apply_filters (model , "create" ):
420435 # if any filters were applied, re-validate the model
421436 validate_model (model , model_context , aliases )
437+
422438 try :
439+ archive_helper = None
440+ archive_file_name = model_context .get_archive_file_name ()
441+ if archive_file_name :
442+ domain_path = _get_domain_path (model_context , model )
443+ archive_helper = ArchiveHelper (archive_file_name , domain_path , __logger , ExceptionType .CREATE )
444+
445+ has_atp = validate_rcu_args_and_model (model_context , model , archive_helper , alias_helper )
423446
424- has_atp = validateRCUArgsAndModel (model_context , model , alias_helper )
425447 # check if there is an atpwallet and extract in the domain dir
426448 # it is to support non JRF domain but user wants to use ATP database
427- archive_file_name = model_context .get_archive_file_name ()
428- if not has_atp and archive_file_name and os .path .exists (archive_file_name ):
429- archive_file = WLSDeployArchive (archive_file_name )
430- if archive_file :
431- atp_wallet_zipentry = archive_file .getATPWallet ()
432- if atp_wallet_zipentry :
433- atp_helper .extract_walletzip (model , model_context , archive_file , atp_wallet_zipentry )
449+ if not has_atp and archive_helper :
450+ archive_helper .extract_atp_wallet ()
434451
435452 creator = DomainCreator (model , model_context , aliases )
436453 creator .create ()
0 commit comments