@@ -42,7 +42,7 @@ class ModelContext(object):
4242
4343 DB_USER_DEFAULT = 'SYS'
4444
45- def __init__ (self , program_name , arg_map ):
45+ def __init__ (self , program_name , arg_map = None ):
4646 """
4747 Create a new model context instance.
4848 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):
112112 if self ._wlst_mode is None :
113113 self ._wlst_mode = WlstModes .OFFLINE
114114
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 )
116123
117124 def __copy_from_args (self , arg_map ):
118125 _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 :
120134 self ._oracle_home = arg_map [CommandLineArgUtil .ORACLE_HOME_SWITCH ]
121135 psu = XPathUtil (self ._oracle_home ).getPSU ()
122136 if psu is not None :
0 commit comments