3131
3232from wlsdeploy .aliases .wlst_modes import WlstModes
3333from wlsdeploy .exception import exception_helper
34+ from wlsdeploy .exception .expection_types import ExceptionType
3435from wlsdeploy .logging .platform_logger import PlatformLogger
3536from wlsdeploy .tool .discover import discoverer
3637from wlsdeploy .tool .discover .deployments_discoverer import DeploymentsDiscoverer
4142from wlsdeploy .tool .util import filter_helper
4243from wlsdeploy .tool .util import model_context_helper
4344from wlsdeploy .tool .util .variable_injector import VariableInjector
45+ from wlsdeploy .tool .util import wlst_helper
46+ from wlsdeploy .tool .util .wlst_helper import WlstHelper
4447from wlsdeploy .tool .validate .validator import Validator
4548from wlsdeploy .util import getcreds
4649from wlsdeploy .util import model_translator
4750from wlsdeploy .util import path_utils
4851from wlsdeploy .util import tool_exit
49- from wlsdeploy .util import wlst_extended
50- from wlsdeploy .util import wlst_helper
5152from wlsdeploy .util .cla_utils import CommandLineArgUtil
5253from wlsdeploy .util .model import Model
5354from wlsdeploy .util .weblogic_helper import WebLogicHelper
5455
55- wlst_extended .wlst_functions = globals ()
56+ wlst_helper .wlst_functions = globals ()
5657
5758_program_name = 'discoverDomain'
5859_class_name = 'discover'
@@ -216,19 +217,23 @@ def __process_java_home(optional_arg_map):
216217 __logger .info ('WLSDPLY-06027' , java_home_name , iae .getLocalizedMessage (),
217218 class_name = _class_name , method_name = _method_name )
218219
219- def __discover (model_context , aliases , injector ):
220+
221+ def __discover (model_context , aliases , injector , helper ):
220222 """
221223 Populate the model from the domain.
222224 :param model_context: the model context
225+ :param aliases: aliases instance for discover
226+ :param injector: variable injector instance
227+ :param helper: wlst_helper instance
223228 :return: the fully-populated model
224229 :raises DiscoverException: if an error occurred while discover the domain
225230 """
226231 _method_name = '__discover'
227232 model = Model ()
228233 base_location = LocationContext ()
229- __connect_to_domain (model_context )
234+ __connect_to_domain (model_context , helper )
230235 try :
231- _add_domain_name (base_location , aliases )
236+ _add_domain_name (base_location , aliases , helper )
232237 DomainInfoDiscoverer (model_context , model .get_model_domain_info (), base_location , wlst_mode = __wlst_mode ,
233238 aliases = aliases , variable_injector = injector ).discover ()
234239 TopologyDiscoverer (model_context , model .get_model_topology (), base_location , wlst_mode = __wlst_mode ,
@@ -247,15 +252,15 @@ def __discover(model_context, aliases, injector):
247252 __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
248253 raise ex
249254
250- __disconnect_domain ()
255+ __disconnect_domain (helper )
251256 return model
252257
253258
254- def _add_domain_name (location , aliases ):
259+ def _add_domain_name (location , aliases , helper ):
255260 _method_name = '_get_domain_name'
256261 try :
257- wlst_helper .cd ('/' )
258- domain_name = wlst_helper .get (model_constants .DOMAIN_NAME )
262+ helper .cd ('/' )
263+ domain_name = helper .get (model_constants .DOMAIN_NAME )
259264 except PyWLSTException , pe :
260265 de = exception_helper .create_discover_exception ('WLSDPLY-06020' , pe .getLocalizedMessage ())
261266 __logger .throwing (class_name = _class_name , method_name = _method_name , error = de )
@@ -281,19 +286,20 @@ def __discover_multi_tenant(model, model_context, base_location, aliases, inject
281286 return
282287
283288
284- def __connect_to_domain (model_context ):
289+ def __connect_to_domain (model_context , helper ):
285290 """
286291 Connects WLST to the domain by either connecting to the Admin Server or reading the domain from disk.
287292 :param model_context: the model context
293+ :param helper: wlst helper instance
288294 :raises DiscoverException: if a WLST error occurs while connecting to or reading the domain
289295 """
290296 _method_name = '__connect_to_domain'
291297
292298 __logger .entering (class_name = _class_name , method_name = _method_name )
293299 if __wlst_mode == WlstModes .ONLINE :
294300 try :
295- wlst_helper .connect (model_context .get_admin_user (), model_context .get_admin_password (),
296- model_context .get_admin_url ())
301+ helper .connect (model_context .get_admin_user (), model_context .get_admin_password (),
302+ model_context .get_admin_url ())
297303 except PyWLSTException , wlst_ex :
298304 ex = exception_helper .create_discover_exception ('WLSDPLY-06001' , model_context .get_admin_url (),
299305 model_context .get_admin_user (),
@@ -302,7 +308,7 @@ def __connect_to_domain(model_context):
302308 raise ex
303309 else :
304310 try :
305- wlst_helper .read_domain (model_context .get_domain_home ())
311+ helper .read_domain (model_context .get_domain_home ())
306312 except PyWLSTException , wlst_ex :
307313 wls_version = WebLogicHelper (__logger ).get_actual_weblogic_version ()
308314 ex = exception_helper .create_discover_exception ('WLSDPLY-06002' , model_context .get_domain_home (),
@@ -354,25 +360,26 @@ def __close_archive(model_context):
354360 return
355361
356362
357- def __disconnect_domain ():
363+ def __disconnect_domain (helper ):
358364 """
359365 Disconnects WLST from the domain by either disconnecting from the Admin Server or closing the domain read from disk.
366+ :param helper: wlst_helper instance
360367 :raises DiscoverException: if a WLST error occurred while disconnecting or closing the domain
361368 """
362369 _method_name = '__disconnect_domain'
363370
364371 __logger .entering (class_name = _class_name , method_name = _method_name )
365372 if __wlst_mode == WlstModes .ONLINE :
366373 try :
367- wlst_helper .disconnect ()
374+ helper .disconnect ()
368375 except PyWLSTException , wlst_ex :
369376 ex = exception_helper .create_discover_exception ('WLSDPLY-06006' ,
370377 wlst_ex .getLocalizedMessage (), error = wlst_ex )
371378 __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
372379 raise ex
373380 else :
374381 try :
375- wlst_helper .close_domain ()
382+ helper .close_domain ()
376383 except PyWLSTException , wlst_ex :
377384 ex = exception_helper .create_discover_exception ('WLSDPLY-06007' ,
378385 wlst_ex .getLocalizedMessage (), error = wlst_ex )
@@ -494,7 +501,8 @@ def main(args):
494501 for index , arg in enumerate (args ):
495502 __logger .finer ('sys.argv[{0}] = {1}' , str (index ), str (arg ), class_name = _class_name , method_name = _method_name )
496503
497- wlst_helper .silence ()
504+ helper = WlstHelper (ExceptionType .DISCOVER )
505+ helper .silence ()
498506
499507 exit_code = CommandLineArgUtil .PROG_OK_EXIT_CODE
500508
@@ -528,7 +536,7 @@ def main(args):
528536 else :
529537 __logger .info ('WLSDPLY-06024' , class_name = _class_name , method_name = _method_name )
530538 try :
531- model = __discover (model_context , aliases , discover_injector )
539+ model = __discover (model_context , aliases , discover_injector , helper )
532540 except DiscoverException , ex :
533541 __logger .severe ('WLSDPLY-06011' , _program_name , model_context .get_domain_name (),
534542 model_context .get_domain_home (), ex .getLocalizedMessage (),
0 commit comments