@@ -42,7 +42,7 @@ class ModelContext(object):
42
42
43
43
DB_USER_DEFAULT = 'SYS'
44
44
45
- def __init__ (self , program_name , arg_map ):
45
+ def __init__ (self , program_name , arg_map = None ):
46
46
"""
47
47
Create a new model context instance.
48
48
Tools should use model_context_helper.create_context(), to ensure that the typedef is initialized correctly.
@@ -112,11 +112,25 @@ def __init__(self, program_name, arg_map):
112
112
if self ._wlst_mode is None :
113
113
self ._wlst_mode = WlstModes .OFFLINE
114
114
115
- self .__copy_from_args (arg_map )
115
+ # This if test is for the tool_main's creation of the exit_context, which is
116
+ # used for argument parsing in case an error is raised. The issue is that
117
+ # __copy_from_args tries to determine the PSU version but since the Oracle Home
118
+ # is not available, the PSU detection logic and erroneously logs that there is
119
+ # no PSU when there is (and that gets logged about 70 lines down in the log file).
120
+ #
121
+ if arg_map is not None :
122
+ self .__copy_from_args (arg_map )
116
123
117
124
def __copy_from_args (self , arg_map ):
118
125
_method_name = '__copy_from_args'
119
- if CommandLineArgUtil .ORACLE_HOME_SWITCH in arg_map :
126
+
127
+ # No need to try to get the PSU if the -oracle_home is empty...
128
+ #
129
+ # This is yet another special case where something during the loading of
130
+ # the typedef file creates a sparse model_context object with the -oracle_home
131
+ # set to an empty string.
132
+ #
133
+ if CommandLineArgUtil .ORACLE_HOME_SWITCH in arg_map and len (arg_map [CommandLineArgUtil .ORACLE_HOME_SWITCH ]) > 0 :
120
134
self ._oracle_home = arg_map [CommandLineArgUtil .ORACLE_HOME_SWITCH ]
121
135
psu = XPathUtil (self ._oracle_home ).getPSU ()
122
136
if psu is not None :
0 commit comments