Skip to content

Commit 327ba42

Browse files
for remote make sure file system path is absolute (#1143)
1 parent 71c2f8f commit 327ba42

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

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

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from oracle.weblogic.deploy.util import PyOrderedDict as OrderedDict
99
from oracle.weblogic.deploy.util import StringUtils
10+
from oracle.weblogic.deploy.util import WLSDeployArchive
1011
from oracle.weblogic.deploy.util import WLSDeployArchiveIOException
1112

1213
from wlsdeploy.aliases import model_constants
@@ -205,17 +206,22 @@ def archive_file_store_directory(self, file_store_name, file_store_dictionary):
205206
directory = file_store_dictionary[model_constants.DIRECTORY]
206207
if not StringUtils.isEmpty(directory):
207208
archive_file = self._model_context.get_archive_file()
208-
try:
209-
new_source_name = archive_file.addFileStoreDirectory(file_store_name)
210-
except WLSDeployArchiveIOException, wioe:
211-
de = exception_helper.create_discover_exception('WLSDPLY-06348', file_store_name, directory,
212-
wioe.getLocalizedMessage())
213-
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
214-
raise de
215-
if new_source_name is not None:
216-
_logger.info('WLSDPLY-06349', file_store_name, new_source_name, class_name=_class_name,
217-
method_name=_method_name)
218-
file_store_dictionary[model_constants.DIRECTORY] = new_source_name
209+
if self._model_context.is_remote():
210+
new_name = archive_file.getFileStoreArchivePath(file_store_name)
211+
self.add_to_remote_map(file_store_name, new_name,
212+
WLSDeployArchive.ArchiveEntryType.FILE_STORE.name())
213+
elif not self._model_context.skip_archive():
214+
try:
215+
new_source_name = archive_file.addFileStoreDirectory(file_store_name)
216+
except WLSDeployArchiveIOException, wioe:
217+
de = exception_helper.create_discover_exception('WLSDPLY-06348', file_store_name, directory,
218+
wioe.getLocalizedMessage())
219+
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
220+
raise de
221+
if new_source_name is not None:
222+
_logger.info('WLSDPLY-06349', file_store_name, new_source_name, class_name=_class_name,
223+
method_name=_method_name)
224+
file_store_dictionary[model_constants.DIRECTORY] = new_source_name
219225

220226
_logger.exiting(class_name=_class_name, method_name=_method_name)
221227
return

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None, creden
6565
self._wls_version = self._weblogic_helper.get_actual_weblogic_version()
6666

6767
def add_to_remote_map(self, local_name, archive_name, file_type):
68+
if not os.path.isabs(local_name):
69+
local_name = os.path.join(self._model_context.get_domain_home(), local_name)
70+
# we don't know the remote machine type, so automatically turn into forward
71+
# slashes.
72+
local_name = local_name.replace('\\', '/')
6873
remote_dict[local_name] = OrderedDict()
6974
remote_dict[local_name][REMOTE_TYPE] = file_type
7075
remote_dict[local_name][REMOTE_ARCHIVE_PATH] = archive_name

0 commit comments

Comments
 (0)