@@ -94,22 +94,22 @@ def get_shared_libraries(self):
9494 location .add_name_token (name_token , library )
9595 result [library ] = OrderedDict ()
9696 self ._populate_model_parameters (result [library ], location )
97- self ._add_shared_libraries_to_archive (library , result [library ])
97+ self ._add_shared_library_to_archive (library , result [library ])
9898 self ._discover_subfolders (result [library ], location )
9999 location .remove_name_token (name_token )
100100
101101 _logger .exiting (class_name = _class_name , method_name = _method_name , result = model_top_folder_name )
102102 return model_top_folder_name , result
103103
104- def _add_shared_libraries_to_archive (self , library_name , library_dict ):
104+ def _add_shared_library_to_archive (self , library_name , library_dict ):
105105 """
106106 Add the binary or directory referenced by the shared library to the archive file.
107107 If the binary can not be located and added to the archive file, un-target the library and log the problem.
108108 :param library_name: name of the shared library
109109 :param library_dict: containing the shared library information
110110 :raise DiscoverException: An unexpected exception occurred trying to write the library to the archive
111111 """
112- _method_name = 'add_shared_library_to_archive '
112+ _method_name = '_add_shared_library_to_archive '
113113 _logger .entering (library_name , class_name = _class_name , method_name = _method_name )
114114
115115 archive_file = self ._model_context .get_archive_file ()
@@ -156,73 +156,12 @@ def _add_shared_libraries_to_archive(self, library_name, library_dict):
156156 library_dict [model_constants .SOURCE_PATH ] = new_source_name
157157 _logger .finer ('WLSDPLY-06388' , library_name , new_source_name , class_name = _class_name ,
158158 method_name = _method_name )
159- self ._add_shared_libray_plan_to_archive (library_name , library_dict )
160159
161- _logger .exiting (class_name = _class_name , method_name = _method_name )
160+ # plan may need to go into archive, even if source path was excluded
161+ self ._add_deployment_plan_to_archive (library_name , library_dict , model_constants .LIBRARY )
162162
163- def _add_shared_libray_plan_to_archive (self , library_name , library_dict ):
164- """
165- Add the shared library deployment plan to the archive file. Create a unique name for the deployment plan from
166- the library binary name and the plan name. If the plan cannot be added to the archive file, the plan
167- information will remain in the model library entry, but a warning will be generated.
168- :param library_name: shared library name in the model
169- :param library_dict: containing the library information
170- :raise: DiscoverException: An unexpected exception occurred trying to write the plan to the archive file
171- """
172- _method_name = 'add_application_plan_to_archive'
173- _logger .entering (library_name , class_name = _class_name , method_name = _method_name )
174- archive_file = self ._model_context .get_archive_file ()
175- if model_constants .PLAN_PATH in library_dict :
176- library_source_name = library_dict [model_constants .SOURCE_PATH ]
177- plan_path = library_dict [model_constants .PLAN_PATH ]
178- if plan_path :
179- _logger .info ('WLSDPLY-06389' , library_name , plan_path , class_name = _class_name , method_name = _method_name )
180- new_plan_name = self .get_shlib_plan (plan_path , library_dict , library_source_name , archive_file )
181- if new_plan_name is not None :
182- _logger .finer ('WLSDPLY-06390' , library_name , new_plan_name ,
183- class_name = _class_name , method_name = _method_name )
184- library_dict [model_constants .PLAN_PATH ] = new_plan_name
185163 _logger .exiting (class_name = _class_name , method_name = _method_name )
186164
187- def get_shlib_plan (self , plan_path , library_dict , library_source_name , archive_file ):
188- _method_name = 'get_shlib_plan'
189-
190- plan_file_name = plan_path
191- if not self ._model_context .is_remote ():
192- plan_path = self ._convert_path (plan_path )
193- plan_dir = None
194- if model_constants .PLAN_DIR in library_dict :
195- plan_dir = library_dict [model_constants .PLAN_DIR ]
196- del library_dict [model_constants .PLAN_DIR ]
197- plan_file_name = self ._resolve_deployment_plan_path (plan_dir , plan_path )
198- new_plan_name = None
199- if self ._model_context .is_remote ():
200- new_plan_name = WLSDeployArchive .getShLibArchivePath (plan_path )
201- self .add_to_remote_map (plan_path , new_plan_name ,
202- WLSDeployArchive .ArchiveEntryType .SHLIB_PLAN .name ())
203- elif not self ._model_context .is_skip_archive ():
204- try :
205- if self ._model_context .is_ssh ():
206- plan_file_name = self .download_deployment_from_remote_server (plan_file_name ,
207- self .download_temporary_dir ,
208- "sharedLibraries" )
209-
210- new_plan_name = archive_file .addApplicationDeploymentPlan (plan_file_name ,
211- _generate_new_plan_name (
212- library_source_name ,
213- plan_file_name ))
214- except IllegalArgumentException , iae :
215- _logger .warning ('WLSDPLY-06385' , library_source_name , plan_file_name ,
216- iae .getLocalizedMessage (), class_name = _class_name ,
217- method_name = _method_name )
218- except WLSDeployArchiveIOException , wioe :
219- de = exception_helper .create_discover_exception ('WLSDPLY-06387' , library_source_name ,
220- plan_file_name ,
221- wioe .getLocalizedMessage ())
222- _logger .throwing (class_name = _class_name , method_name = _method_name , error = de )
223- raise de
224- return new_plan_name
225-
226165 def get_applications (self ):
227166 """
228167 Discover application deployment information from the domain. Collect the application deployment binaries into
@@ -346,43 +285,51 @@ def _add_application_to_archive(self, application_name, application_dict):
346285 _logger .finer ('WLSDPLY-06398' , application_name , new_source_name , class_name = _class_name ,
347286 method_name = _method_name )
348287 application_dict [model_constants .SOURCE_PATH ] = new_source_name
349- self .add_application_plan_to_archive (application_name , application_dict )
288+
289+ # plan may need to go into archive, even if source path was excluded
290+ self ._add_deployment_plan_to_archive (application_name , application_dict , model_constants .APPLICATION )
350291
351292 _logger .exiting (class_name = _class_name , method_name = _method_name )
352293
353- def add_application_plan_to_archive (self , application_name , application_dict ):
294+ def _add_deployment_plan_to_archive (self , deployment_name , deployment_dict , deployment_type ):
354295 """
355- Add the application deployment plan to the archive file. Create a unique name for the deployment plan from
356- the application name and the plan name. If the plan cannot be located and added to the archive file, the
296+ Add the application/library deployment plan to the archive file. Create a unique name for the deployment plan
297+ from the deployment name and the plan name. If the plan cannot be located and added to the archive file, the
357298 plan will remain in the model, but a warning message will be generated about the problem.
358- :param application_name : name of the application in the model
359- :param application_dict : containing the application information
299+ :param deployment_name : name of the deployment in the model
300+ :param deployment_dict : containing the deployment information
360301 :raise: DiscoverException: An unexpected exception occurred trying to write the plan to the archive file
361302 """
362- _method_name = 'add_application_plan_to_archive '
363- _logger .entering (application_name , class_name = _class_name , method_name = _method_name )
303+ _method_name = '_add_deployment_plan_to_archive '
304+ _logger .entering (deployment_name , class_name = _class_name , method_name = _method_name )
364305 archive_file = self ._model_context .get_archive_file ()
365306
366- model_plan_path = self ._get_dictionary_attribute_with_path_tokens_replaced (application_dict , PLAN_PATH )
307+ model_plan_path = self ._get_dictionary_attribute_with_path_tokens_replaced (deployment_dict , PLAN_PATH )
367308 if model_plan_path is not None :
368- app_source_name = self ._get_dictionary_attribute_with_path_tokens_replaced (application_dict , SOURCE_PATH )
369- model_plan_dir = self ._get_dictionary_attribute_with_path_tokens_replaced (application_dict , PLAN_DIR )
309+ source_name = self ._get_dictionary_attribute_with_path_tokens_replaced (deployment_dict , SOURCE_PATH )
310+ model_plan_dir = self ._get_dictionary_attribute_with_path_tokens_replaced (deployment_dict , PLAN_DIR )
370311
371312 if model_plan_dir is not None and self .path_helper .is_relative_path (model_plan_path ):
372313 plan_path = self .path_helper .join (model_plan_dir , model_plan_path )
373314 else :
374315 plan_path = model_plan_path
375316
376317 if plan_path :
377- if not self ._model_context .is_remote ():
378- plan_path = self ._convert_path (plan_path )
379- _logger .info ('WLSDPLY-06402' , application_name , plan_path , class_name = _class_name ,
380- method_name = _method_name )
381- new_plan_name = self ._get_plan_path (plan_path , archive_file , app_source_name , application_name , application_dict )
382- if new_plan_name is not None :
383- _logger .finer ('WLSDPLY-06399' , application_name , new_plan_name ,
384- class_name = _class_name , method_name = _method_name )
385- application_dict [model_constants .PLAN_PATH ] = new_plan_name
318+ if self ._is_file_to_exclude_from_archive (plan_path ):
319+ _logger .info ('WLSDPLY-06406' , deployment_type , deployment_name ,
320+ class_name = _class_name , method_name = _method_name )
321+ else :
322+ if not self ._model_context .is_remote ():
323+ plan_path = self ._convert_path (plan_path )
324+ _logger .info ('WLSDPLY-06407' , plan_path , deployment_type , deployment_name ,
325+ class_name = _class_name , method_name = _method_name )
326+ new_plan_name = self ._get_plan_path (plan_path , archive_file , source_name , deployment_type ,
327+ deployment_name , deployment_dict )
328+ if new_plan_name is not None :
329+ _logger .finer ('WLSDPLY-06408' , deployment_type , deployment_name , new_plan_name ,
330+ class_name = _class_name , method_name = _method_name )
331+ deployment_dict [model_constants .PLAN_PATH ] = new_plan_name
332+
386333 _logger .exiting (class_name = _class_name , method_name = _method_name )
387334
388335 def _add_structured_application_to_archive (self , application_name , application_dict , location , install_root ):
@@ -593,35 +540,45 @@ def _disconnect_target(self, application_name, application_dict, message):
593540 _logger .warning ('WLSDPLY-06396' , application_name , message ,
594541 class_name = _class_name , method_name = _method_name )
595542
596- def _get_plan_path (self , plan_path , archive_file , app_source_name , application_name , application_dict ):
543+ def _get_plan_path (self , plan_path , archive_file , source_name , deployment_type , deployment_name , deployment_dict ):
597544 _method_name = '_get_plan_path'
545+
598546 plan_dir = None
599- if model_constants .PLAN_DIR in application_dict :
600- plan_dir = application_dict [model_constants .PLAN_DIR ]
601- del application_dict [model_constants .PLAN_DIR ]
547+ if model_constants .PLAN_DIR in deployment_dict :
548+ plan_dir = deployment_dict [model_constants .PLAN_DIR ]
549+ del deployment_dict [model_constants .PLAN_DIR ]
602550 plan_file_name = self ._resolve_deployment_plan_path (plan_dir , plan_path )
551+
552+ if deployment_type == model_constants .LIBRARY :
553+ archive_entry_type = WLSDeployArchive .ArchiveEntryType .SHLIB_PLAN
554+ download_file_type = 'sharedLibraries'
555+ remote_archive_path = WLSDeployArchive .getShlibPlanArchivePath (plan_file_name )
556+ archive_add_method = archive_file .addSharedLibraryDeploymentPlan
557+ else :
558+ archive_entry_type = WLSDeployArchive .ArchiveEntryType .APPLICATION_PLAN
559+ download_file_type = 'applications'
560+ remote_archive_path = WLSDeployArchive .getApplicationPlanArchivePath (plan_file_name )
561+ archive_add_method = archive_file .addApplicationDeploymentPlan
562+
603563 if self ._model_context .is_remote ():
604- new_plan_name = WLSDeployArchive .getApplicationPlanArchivePath (plan_file_name )
605- self .add_to_remote_map (plan_path , new_plan_name ,
606- WLSDeployArchive .ArchiveEntryType .APPLICATION_PLAN .name ())
564+ new_plan_name = remote_archive_path
565+ self .add_to_remote_map (plan_path , new_plan_name , archive_entry_type .name ())
607566 elif not self ._model_context .is_skip_archive ():
608567 try :
609568 if self ._model_context .is_ssh ():
610- plan_file_name = self .download_deployment_from_remote_server (plan_file_name ,
611- self .download_temporary_dir ,
612- "applications" )
569+ plan_file_name = self .download_deployment_from_remote_server (
570+ plan_file_name , self .download_temporary_dir , download_file_type )
613571
614- new_plan_name = _generate_new_plan_name (app_source_name , plan_file_name )
572+ new_plan_name = _generate_new_plan_name (source_name , plan_file_name )
615573 if new_plan_name is not None :
616- new_plan_name = archive_file . addApplicationDeploymentPlan (plan_file_name , new_plan_name )
574+ new_plan_name = archive_add_method (plan_file_name , new_plan_name )
617575 except IllegalArgumentException , iae :
618- _logger .warning ('WLSDPLY-06395' , application_name , plan_file_name ,
619- iae .getLocalizedMessage (), class_name = _class_name ,
620- method_name = _method_name )
576+ _logger .warning ('WLSDPLY-06395' , deployment_type , deployment_name , plan_file_name ,
577+ iae .getLocalizedMessage (), class_name = _class_name , method_name = _method_name )
621578 new_plan_name = None
622579 except WLSDeployArchiveIOException , wioe :
623- de = exception_helper .create_discover_exception ('WLSDPLY-06397' , application_dict , plan_file_name ,
624- wioe .getLocalizedMessage ())
580+ de = exception_helper .create_discover_exception (
581+ 'WLSDPLY-06396' , plan_file_name , deployment_type , deployment_dict , wioe .getLocalizedMessage ())
625582 _logger .throwing (class_name = _class_name , method_name = _method_name , error = de )
626583 raise de
627584
0 commit comments