1515# imports from local packages start here
1616from wlsdeploy .aliases .aliases import Aliases
1717from wlsdeploy .aliases .wlst_modes import WlstModes
18+ from wlsdeploy .exception import exception_helper
1819from wlsdeploy .logging .platform_logger import PlatformLogger
1920from wlsdeploy .tool .extract .domain_resource_extractor import DomainResourceExtractor
2021from wlsdeploy .tool .util import model_context_helper
3334__wlst_mode = WlstModes .OFFLINE
3435
3536__required_arguments = [
36- CommandLineArgUtil .ORACLE_HOME_SWITCH ,
37- CommandLineArgUtil .DOMAIN_HOME_SWITCH ,
38- CommandLineArgUtil .DOMAIN_RESOURCE_FILE_SWITCH
37+ CommandLineArgUtil .ORACLE_HOME_SWITCH
3938]
4039
4140__optional_arguments = [
4241 # Used by shell script to locate WLST
4342 CommandLineArgUtil .DOMAIN_TYPE_SWITCH ,
43+ CommandLineArgUtil .DOMAIN_HOME_SWITCH ,
4444 CommandLineArgUtil .ARCHIVE_FILE_SWITCH ,
4545 CommandLineArgUtil .MODEL_FILE_SWITCH ,
46+ CommandLineArgUtil .TARGET_SWITCH ,
4647 CommandLineArgUtil .VARIABLE_FILE_SWITCH ,
4748 CommandLineArgUtil .USE_ENCRYPTION_SWITCH ,
4849 CommandLineArgUtil .PASSPHRASE_SWITCH ,
4950 CommandLineArgUtil .PASSPHRASE_FILE_SWITCH ,
5051 CommandLineArgUtil .PASSPHRASE_ENV_SWITCH ,
52+ CommandLineArgUtil .OUTPUT_DIR_SWITCH , # move to __required_arguments once DOMAIN_RESOURCE_FILE_SWITCH is removed
53+ CommandLineArgUtil .DOMAIN_RESOURCE_FILE_SWITCH # deprecated, only this program uses it
5154]
5255
5356
@@ -57,6 +60,8 @@ def __process_args(args):
5760 :param args: the command-line arguments list
5861 :raises CLAException: if an error occurs while validating and processing the command-line arguments
5962 """
63+ _method_name = '__process_args'
64+
6065 cla_util = CommandLineArgUtil (_program_name , __required_arguments , __optional_arguments )
6166 cla_util .set_allow_multiple_models (True )
6267 argument_map = cla_util .process_args (args , TOOL_TYPE_EXTRACT )
@@ -70,19 +75,37 @@ def __process_args(args):
7075
7176 # allow unresolved tokens and archive entries
7277 argument_map [CommandLineArgUtil .VALIDATION_METHOD ] = validate_configuration .LAX_METHOD
78+
79+ # if no target type was specified, use wko
80+ if CommandLineArgUtil .TARGET_SWITCH not in argument_map :
81+ argument_map [CommandLineArgUtil .TARGET_SWITCH ] = 'wko'
82+
83+ # warn about deprecated -domain_resource_file argument.
84+ # not needed once -domain_resource_file is removed and -output_dir moves to __required_arguments.
85+ if CommandLineArgUtil .DOMAIN_RESOURCE_FILE_SWITCH in argument_map :
86+ __logger .warning ('WLSDPLY-10040' , CommandLineArgUtil .DOMAIN_RESOURCE_FILE_SWITCH ,
87+ CommandLineArgUtil .OUTPUT_DIR_SWITCH , class_name = _class_name , method_name = _method_name )
88+ elif CommandLineArgUtil .OUTPUT_DIR_SWITCH not in argument_map :
89+ ex = exception_helper .create_cla_exception (CommandLineArgUtil .USAGE_ERROR_EXIT_CODE , 'WLSDPLY-20005' ,
90+ _program_name , CommandLineArgUtil .OUTPUT_DIR_SWITCH ,
91+ class_name = _class_name , method_name = _method_name )
92+ __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
93+ raise ex
94+
7395 return model_context_helper .create_context (_program_name , argument_map )
7496
7597
76- def __extract_resource (model , model_context ):
98+ def __extract_resource (model , model_context , aliases ):
7799 """
78100 Offline deployment orchestration
79101 :param model: the model
80102 :param model_context: the model context
103+ :param aliases: the aliases object
81104 :raises: DeployException: if an error occurs
82105 """
83106 _method_name = '__extract_resource'
84107
85- resource_extractor = DomainResourceExtractor (model , model_context , __logger )
108+ resource_extractor = DomainResourceExtractor (model , model_context , aliases , __logger )
86109 resource_extractor .extract ()
87110 return 0
88111
@@ -119,7 +142,7 @@ def main(args):
119142
120143 try :
121144 model = Model (model_dictionary )
122- exit_code = __extract_resource (model , model_context )
145+ exit_code = __extract_resource (model , model_context , aliases )
123146 except DeployException , ex :
124147 __logger .severe ('WLSDPLY-09015' , _program_name , ex .getLocalizedMessage (), error = ex ,
125148 class_name = _class_name , method_name = _method_name )
0 commit comments