From d0c7d156edb33b728efe8b96862ab84701010808 Mon Sep 17 00:00:00 2001 From: Carolyn Rountree Date: Wed, 8 Jun 2022 09:51:16 -0500 Subject: [PATCH] for remote make sure file system path is absolute --- .../discover/common_resources_discoverer.py | 28 +++++++++++-------- .../wlsdeploy/tool/discover/discoverer.py | 5 ++++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py b/core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py index 646d584923..1421eacf13 100644 --- a/core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py +++ b/core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py @@ -7,6 +7,7 @@ from oracle.weblogic.deploy.util import PyOrderedDict as OrderedDict from oracle.weblogic.deploy.util import StringUtils +from oracle.weblogic.deploy.util import WLSDeployArchive from oracle.weblogic.deploy.util import WLSDeployArchiveIOException from wlsdeploy.aliases import model_constants @@ -205,17 +206,22 @@ def archive_file_store_directory(self, file_store_name, file_store_dictionary): directory = file_store_dictionary[model_constants.DIRECTORY] if not StringUtils.isEmpty(directory): archive_file = self._model_context.get_archive_file() - try: - new_source_name = archive_file.addFileStoreDirectory(file_store_name) - except WLSDeployArchiveIOException, wioe: - de = exception_helper.create_discover_exception('WLSDPLY-06348', file_store_name, directory, - wioe.getLocalizedMessage()) - _logger.throwing(class_name=_class_name, method_name=_method_name, error=de) - raise de - if new_source_name is not None: - _logger.info('WLSDPLY-06349', file_store_name, new_source_name, class_name=_class_name, - method_name=_method_name) - file_store_dictionary[model_constants.DIRECTORY] = new_source_name + if self._model_context.is_remote(): + new_name = archive_file.getFileStoreArchivePath(file_store_name) + self.add_to_remote_map(file_store_name, new_name, + WLSDeployArchive.ArchiveEntryType.FILE_STORE.name()) + elif not self._model_context.skip_archive(): + try: + new_source_name = archive_file.addFileStoreDirectory(file_store_name) + except WLSDeployArchiveIOException, wioe: + de = exception_helper.create_discover_exception('WLSDPLY-06348', file_store_name, directory, + wioe.getLocalizedMessage()) + _logger.throwing(class_name=_class_name, method_name=_method_name, error=de) + raise de + if new_source_name is not None: + _logger.info('WLSDPLY-06349', file_store_name, new_source_name, class_name=_class_name, + method_name=_method_name) + file_store_dictionary[model_constants.DIRECTORY] = new_source_name _logger.exiting(class_name=_class_name, method_name=_method_name) return diff --git a/core/src/main/python/wlsdeploy/tool/discover/discoverer.py b/core/src/main/python/wlsdeploy/tool/discover/discoverer.py index 77b01367d4..b662a0f2ab 100644 --- a/core/src/main/python/wlsdeploy/tool/discover/discoverer.py +++ b/core/src/main/python/wlsdeploy/tool/discover/discoverer.py @@ -65,6 +65,11 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None, creden self._wls_version = self._weblogic_helper.get_actual_weblogic_version() def add_to_remote_map(self, local_name, archive_name, file_type): + if not os.path.isabs(local_name): + local_name = os.path.join(self._model_context.get_domain_home(), local_name) + # we don't know the remote machine type, so automatically turn into forward + # slashes. + local_name = local_name.replace('\\', '/') remote_dict[local_name] = OrderedDict() remote_dict[local_name][REMOTE_TYPE] = file_type remote_dict[local_name][REMOTE_ARCHIVE_PATH] = archive_name