15
15
# imports from local packages start here
16
16
from wlsdeploy .aliases .aliases import Aliases
17
17
from wlsdeploy .aliases .wlst_modes import WlstModes
18
+ from wlsdeploy .exception import exception_helper
18
19
from wlsdeploy .logging .platform_logger import PlatformLogger
19
20
from wlsdeploy .tool .extract .domain_resource_extractor import DomainResourceExtractor
20
21
from wlsdeploy .tool .util import model_context_helper
33
34
__wlst_mode = WlstModes .OFFLINE
34
35
35
36
__required_arguments = [
36
- CommandLineArgUtil .ORACLE_HOME_SWITCH ,
37
- CommandLineArgUtil .DOMAIN_HOME_SWITCH ,
38
- CommandLineArgUtil .DOMAIN_RESOURCE_FILE_SWITCH
37
+ CommandLineArgUtil .ORACLE_HOME_SWITCH
39
38
]
40
39
41
40
__optional_arguments = [
42
41
# Used by shell script to locate WLST
43
42
CommandLineArgUtil .DOMAIN_TYPE_SWITCH ,
43
+ CommandLineArgUtil .DOMAIN_HOME_SWITCH ,
44
44
CommandLineArgUtil .ARCHIVE_FILE_SWITCH ,
45
45
CommandLineArgUtil .MODEL_FILE_SWITCH ,
46
+ CommandLineArgUtil .TARGET_SWITCH ,
46
47
CommandLineArgUtil .VARIABLE_FILE_SWITCH ,
47
48
CommandLineArgUtil .USE_ENCRYPTION_SWITCH ,
48
49
CommandLineArgUtil .PASSPHRASE_SWITCH ,
49
50
CommandLineArgUtil .PASSPHRASE_FILE_SWITCH ,
50
51
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
51
54
]
52
55
53
56
@@ -57,6 +60,8 @@ def __process_args(args):
57
60
:param args: the command-line arguments list
58
61
:raises CLAException: if an error occurs while validating and processing the command-line arguments
59
62
"""
63
+ _method_name = '__process_args'
64
+
60
65
cla_util = CommandLineArgUtil (_program_name , __required_arguments , __optional_arguments )
61
66
cla_util .set_allow_multiple_models (True )
62
67
argument_map = cla_util .process_args (args , TOOL_TYPE_EXTRACT )
@@ -70,19 +75,37 @@ def __process_args(args):
70
75
71
76
# allow unresolved tokens and archive entries
72
77
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
+
73
95
return model_context_helper .create_context (_program_name , argument_map )
74
96
75
97
76
- def __extract_resource (model , model_context ):
98
+ def __extract_resource (model , model_context , aliases ):
77
99
"""
78
100
Offline deployment orchestration
79
101
:param model: the model
80
102
:param model_context: the model context
103
+ :param aliases: the aliases object
81
104
:raises: DeployException: if an error occurs
82
105
"""
83
106
_method_name = '__extract_resource'
84
107
85
- resource_extractor = DomainResourceExtractor (model , model_context , __logger )
108
+ resource_extractor = DomainResourceExtractor (model , model_context , aliases , __logger )
86
109
resource_extractor .extract ()
87
110
return 0
88
111
@@ -119,7 +142,7 @@ def main(args):
119
142
120
143
try :
121
144
model = Model (model_dictionary )
122
- exit_code = __extract_resource (model , model_context )
145
+ exit_code = __extract_resource (model , model_context , aliases )
123
146
except DeployException , ex :
124
147
__logger .severe ('WLSDPLY-09015' , _program_name , ex .getLocalizedMessage (), error = ex ,
125
148
class_name = _class_name , method_name = _method_name )
0 commit comments