Skip to content

Commit 0ab0618

Browse files
committed
Merge branch 'more-skip_archive_fixes' into 'main'
Fixing more issues with -skipArchive and -remote for GitHub issue 1608 See merge request weblogic-cloud/weblogic-deploy-tooling!1766
2 parents fcd55b0 + 528dcc8 commit 0ab0618

File tree

4 files changed

+50
-28
lines changed

4 files changed

+50
-28
lines changed

core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -408,28 +408,39 @@ def archive_jdbc_create_script(self, jdbc_store_name, jdbc_store_dictionary):
408408
"""
409409
_method_name = 'get_jdbc_create_script'
410410
_logger.entering(jdbc_store_name, class_name=_class_name, method_name=_method_name)
411-
if model_constants.CREATE_TABLE_DDL_FILE in jdbc_store_dictionary:
412-
archive_file = self._model_context.get_archive_file()
413-
file_name = self._convert_path(jdbc_store_dictionary[model_constants.CREATE_TABLE_DDL_FILE])
414-
_logger.info('WLSDPLY-06352', jdbc_store_name, file_name, class_name=_class_name, method_name=_method_name)
415-
try:
416-
if self._model_context.is_ssh():
417-
file_name = self.download_deployment_from_remote_server(file_name,
418-
self.download_temporary_dir,
419-
"jdbcScript")
420411

421-
new_source_name = archive_file.addScript(file_name)
422-
except IllegalArgumentException, iae:
423-
_logger.warning('WLSDPLY-06353', jdbc_store_name, file_name,
424-
iae.getLocalizedMessage(), class_name=_class_name,
425-
method_name=_method_name)
412+
if model_constants.CREATE_TABLE_DDL_FILE in jdbc_store_dictionary:
413+
if self._model_context.is_skip_archive():
426414
_logger.exiting(class_name=_class_name, method_name=_method_name)
427415
return
428-
except WLSDeployArchiveIOException, wioe:
429-
de = exception_helper.create_discover_exception('WLSDPLY-06354', jdbc_store_name, file_name,
430-
wioe.getLocalizedMessage())
431-
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
432-
raise de
416+
417+
file_name = self._convert_path(jdbc_store_dictionary[model_constants.CREATE_TABLE_DDL_FILE])
418+
if self._model_context.is_remote():
419+
archive_entry_type = WLSDeployArchive.ArchiveEntryType.SCRIPT
420+
new_source_name = WLSDeployArchive.getScriptArchivePath(file_name)
421+
self.add_to_remote_map(file_name, new_source_name, archive_entry_type.name())
422+
else:
423+
archive_file = self._model_context.get_archive_file()
424+
_logger.info('WLSDPLY-06352', jdbc_store_name, file_name,
425+
class_name=_class_name, method_name=_method_name)
426+
try:
427+
if self._model_context.is_ssh():
428+
file_name = self.download_deployment_from_remote_server(file_name,
429+
self.download_temporary_dir,
430+
"jdbcScript")
431+
432+
new_source_name = archive_file.addScript(file_name)
433+
except IllegalArgumentException, iae:
434+
_logger.warning('WLSDPLY-06353', jdbc_store_name, file_name,
435+
iae.getLocalizedMessage(), class_name=_class_name,
436+
method_name=_method_name)
437+
_logger.exiting(class_name=_class_name, method_name=_method_name)
438+
return
439+
except WLSDeployArchiveIOException, wioe:
440+
de = exception_helper.create_discover_exception('WLSDPLY-06354', jdbc_store_name, file_name,
441+
wioe.getLocalizedMessage())
442+
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
443+
raise de
433444

434445
if new_source_name is None:
435446
new_source_name = file_name

core/src/main/python/wlsdeploy/tool/discover/deployments_discoverer.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,18 @@ def _add_shared_library_to_archive(self, library_name, library_dict):
119119
file_name_path = file_name
120120
if not self._model_context.is_remote():
121121
file_name_path = self._convert_path(file_name)
122+
122123
if self._is_file_to_exclude_from_archive(file_name_path):
123124
_logger.info('WLSDPLY-06383', library_name, class_name=_class_name, method_name=_method_name)
124125
else:
125126
new_source_name = None
126-
if self._model_context.is_remote():
127+
if self._model_context.is_skip_archive():
128+
new_source_name = file_name_path
129+
elif self._model_context.is_remote():
127130
new_source_name = WLSDeployArchive.getSharedLibraryArchivePath(file_name_path)
128131
self.add_to_remote_map(file_name_path, new_source_name,
129132
WLSDeployArchive.ArchiveEntryType.SHARED_LIBRARY.name())
130-
elif not self._model_context.is_skip_archive():
133+
else:
131134
_logger.info('WLSDPLY-06384', library_name, file_name_path, class_name=_class_name,
132135
method_name=_method_name)
133136
try:
@@ -152,6 +155,7 @@ def _add_shared_library_to_archive(self, library_name, library_dict):
152155
wioe.getLocalizedMessage())
153156
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
154157
raise de
158+
155159
if new_source_name is not None:
156160
library_dict[model_constants.SOURCE_PATH] = new_source_name
157161
_logger.finer('WLSDPLY-06388', library_name, new_source_name, class_name=_class_name,
@@ -249,16 +253,19 @@ def _add_application_to_archive(self, application_name, application_dict):
249253
file_name_path = file_name
250254
if not self._model_context.is_remote():
251255
file_name_path = self._convert_path(file_name)
256+
252257
if self._is_file_to_exclude_from_archive(file_name_path):
253258
_logger.info('WLSDPLY-06393', application_name,
254259
class_name=_class_name, method_name=_method_name)
255260
else:
256261
new_source_name = None
257-
if self._model_context.is_remote():
262+
if self._model_context.is_skip_archive():
263+
new_source_name = file_name_path
264+
elif self._model_context.is_remote():
258265
new_source_name = WLSDeployArchive.getApplicationArchivePath(file_name_path)
259266
self.add_to_remote_map(file_name_path, new_source_name,
260267
WLSDeployArchive.ArchiveEntryType.APPLICATION.name())
261-
elif not self._model_context.is_skip_archive():
268+
else:
262269
_logger.info('WLSDPLY-06394', application_name, file_name_path,
263270
class_name=_class_name, method_name=_method_name)
264271
try:
@@ -281,6 +288,7 @@ def _add_application_to_archive(self, application_name, application_dict):
281288
file_name_path, wioe.getLocalizedMessage())
282289
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
283290
raise de
291+
284292
if new_source_name is not None:
285293
_logger.finer('WLSDPLY-06398', application_name, new_source_name, class_name=_class_name,
286294
method_name=_method_name)
@@ -323,6 +331,7 @@ def _add_deployment_plan_to_archive(self, deployment_name, deployment_dict, depl
323331
plan_path = self._convert_path(plan_path)
324332
_logger.info('WLSDPLY-06407', plan_path, deployment_type, deployment_name,
325333
class_name=_class_name, method_name=_method_name)
334+
326335
new_plan_name = self._get_plan_path(plan_path, archive_file, source_name, deployment_type,
327336
deployment_name, deployment_dict)
328337
if new_plan_name is not None:

core/src/main/python/wlsdeploy/tool/discover/global_resources_discoverer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _add_mimemapping_file_to_archive(self, web_app_container):
190190
new_file_name = WLSDeployArchive.getMimeMappingArchivePath(file_path)
191191
self.add_to_remote_map(file_path, new_file_name,
192192
WLSDeployArchive.ArchiveEntryType.MIME_MAPPING.name())
193-
else:
193+
elif not self._model_context.is_skip_archive():
194194
if self._model_context.is_ssh():
195195
file_path = self.download_deployment_from_remote_server(file_path, self.download_temporary_dir,
196196
"mimeFile")

core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,6 @@ def _add_library(self, server_name, classpath_name):
932932
file_name_path = self.download_deployment_from_remote_server(file_name_path,
933933
self.download_temporary_dir,
934934
"classPathLibraries")
935-
936-
937935
new_source_name = archive_file.addClasspathLibrary(file_name_path)
938936
except IllegalArgumentException, iae:
939937
_logger.warning('WLSDPLY-06620', server_name, file_name_path, iae.getLocalizedMessage(),
@@ -943,6 +941,7 @@ def _add_library(self, server_name, classpath_name):
943941
wioe.getLocalizedMessage(), error=wioe)
944942
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
945943
raise de
944+
946945
if new_source_name is not None:
947946
return_name = new_source_name
948947
_logger.exiting(class_name=_class_name, method_name=_method_name, result=return_name)
@@ -959,15 +958,18 @@ def _add_jdbc_transaction_log_create_table_ddl_file_to_archive(self, model_name,
959958
_method_name = '_add_jdbc_transaction_log_create_table_ddl_file_to_archive'
960959
_logger.entering(model_name, model_value, str_helper.to_string(location),
961960
class_name=_class_name, method_name=_method_name)
961+
962962
new_name = None
963963
if not string_utils.is_empty(model_value):
964964
entity_type, entity_name = self._get_server_or_template_name_from_location(location)
965965
archive_file = self._model_context.get_archive_file()
966966

967-
if self._model_context.is_remote():
967+
if self._model_context.is_skip_archive():
968+
new_name = model_value
969+
elif self._model_context.is_remote():
968970
new_name = WLSDeployArchive.getScriptArchivePath(model_value)
969971
self.add_to_remote_map(model_value, new_name, WLSDeployArchive.ArchiveEntryType.SCRIPT.name())
970-
elif not self._model_context.is_skip_archive():
972+
else:
971973
file_path = self._convert_path(model_value)
972974
try:
973975
if self._model_context.is_ssh():

0 commit comments

Comments
 (0)