27
27
28
28
from wlsdeploy .aliases .aliases import Aliases
29
29
from 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
30
33
from wlsdeploy .aliases .wlst_modes import WlstModes
31
34
from wlsdeploy .exception import exception_helper
32
35
from wlsdeploy .exception .expection_types import ExceptionType
37
40
from wlsdeploy .tool .create .domain_typedef import CREATE_DOMAIN
38
41
from wlsdeploy .tool .util import filter_helper
39
42
from wlsdeploy .tool .util .alias_helper import AliasHelper
43
+ from wlsdeploy .tool .util .archive_helper import ArchiveHelper
40
44
from wlsdeploy .tool .validate .validator import Validator
41
45
from wlsdeploy .util import cla_helper
42
46
from wlsdeploy .util import getcreds
@@ -289,7 +293,6 @@ def __process_opss_args(optional_arg_map):
289
293
return
290
294
291
295
292
-
293
296
def validate_model (model_dictionary , model_context , aliases ):
294
297
_method_name = 'validate_model'
295
298
@@ -311,7 +314,9 @@ def validate_model(model_dictionary, model_context, aliases):
311
314
tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
312
315
313
316
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
+
315
320
has_atpdbinfo = 0
316
321
domain_info = model [model_constants .DOMAIN_INFO ]
317
322
if domain_info is not None :
@@ -321,26 +326,20 @@ def validateRCUArgsAndModel(model_context, model, alias_helper):
321
326
has_regular_db = rcu_db_info .is_regular_db ()
322
327
has_atpdbinfo = rcu_db_info .has_atpdbinfo ()
323
328
324
- if model_context . get_archive_file_name () and not has_regular_db :
329
+ if archive_helper and not has_regular_db :
325
330
System .setProperty ('oracle.jdbc.fanEnabled' , 'false' )
326
331
327
332
# 1. If it does not have the oracle.net.tns_admin specified, then extract to domain/atpwallet
328
333
# 2. If it is plain old regular oracle db, do nothing
329
334
# 3. If it deos not have tns_admin in the model, then the wallet must be in the archive
330
335
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 :
338
338
# update the model to add the tns_admin
339
339
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
341
341
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 )
344
343
cla_helper .clean_up_temp_files ()
345
344
tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
346
345
@@ -355,6 +354,22 @@ def validateRCUArgsAndModel(model_context, model, alias_helper):
355
354
return has_atpdbinfo
356
355
357
356
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
+
358
373
def main (args ):
359
374
"""
360
375
The entry point for the create domain tool.
@@ -419,18 +434,20 @@ def main(args):
419
434
if filter_helper .apply_filters (model , "create" ):
420
435
# if any filters were applied, re-validate the model
421
436
validate_model (model , model_context , aliases )
437
+
422
438
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 )
423
446
424
- has_atp = validateRCUArgsAndModel (model_context , model , alias_helper )
425
447
# check if there is an atpwallet and extract in the domain dir
426
448
# 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 ()
434
451
435
452
creator = DomainCreator (model , model_context , aliases )
436
453
creator .create ()
0 commit comments