Skip to content

Commit bb445bc

Browse files
authored
Issue #344 - Skip classpath libraries in attribute archive extraction; check each archive entry in lists (#351)
1 parent f29f7d9 commit bb445bc

File tree

2 files changed

+55
-21
lines changed

2 files changed

+55
-21
lines changed

core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ public static boolean isPathIntoArchive(String path) {
149149
return result;
150150
}
151151

152+
/**
153+
* Determine if the specified path is in the classpath libraries folder.
154+
* This includes the case where the specified path is the classpath libraries folder.
155+
* @param path the path to be checked
156+
* @return true if the specified path matches or is under the classpath libraries folder
157+
*/
158+
public static boolean isClasspathEntry(String path) {
159+
return path.startsWith(ARCHIVE_CPLIB_TARGET_DIR);
160+
}
161+
152162
/**
153163
* Get the current file name for the JCSLifecycleArchive file.
154164
*

core/src/main/python/wlsdeploy/tool/create/creator.py

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -307,27 +307,8 @@ def _set_attribute(self, location, model_name, model_value, uses_path_tokens_nam
307307
"""
308308
_method_name = '_set_attribute'
309309

310-
if model_name in uses_path_tokens_names and WLSDeployArchive.isPathIntoArchive(model_value):
311-
if self.archive_helper is not None:
312-
if self.archive_helper.contains_file(model_value):
313-
#
314-
# We cannot extract the files until the domain directory exists
315-
# so add them to the list so that they can be extracted after
316-
# domain creation completes.
317-
#
318-
self.files_to_extract_from_archive.append(model_value)
319-
else:
320-
path = self.alias_helper.get_model_folder_path(location)
321-
archive_file_name = self.model_context.get_archive_file_name
322-
ex = exception_helper.create_create_exception('WLSDPLY-12121', model_name, path,
323-
model_value, archive_file_name)
324-
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
325-
raise ex
326-
else:
327-
path = self.alias_helper.get_model_folder_path(location)
328-
ex = exception_helper.create_create_exception('WLSDPLY-12122', model_name, path, model_value)
329-
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
330-
raise ex
310+
if (model_name in uses_path_tokens_names) and (model_value is not None):
311+
self._extract_archive_files(location, model_name, model_value)
331312

332313
wlst_name, wlst_value = self.alias_helper.get_wlst_attribute_name_and_value(location, model_name, model_value)
333314

@@ -350,6 +331,49 @@ def _set_attribute(self, location, model_name, model_value, uses_path_tokens_nam
350331
self.wlst_helper.set(wlst_name, wlst_value, masked=masked)
351332
return
352333

334+
def _extract_archive_files(self, location, model_name, model_value):
335+
"""
336+
Extract any archive files associated with the specified model attribute value.
337+
The attribute has already been determined to use path tokens.
338+
:param location: the location of the attribute
339+
:param model_name: the model attribute name
340+
:param model_value: the model attribute value
341+
:raises: CreateException: if an error occurs
342+
"""
343+
_method_name = '_extract_archive_files'
344+
345+
# model value should be a list, comma-delimited string, or string
346+
model_paths = model_value
347+
if isinstance(model_value, str):
348+
model_paths = model_value.split(',')
349+
350+
for model_path in model_paths:
351+
model_path = model_path.strip()
352+
353+
# check for path starting with "wlsdeploy/".
354+
# skip classpath libraries, they are extracted elsewhere.
355+
if WLSDeployArchive.isPathIntoArchive(model_path) and not WLSDeployArchive.isClasspathEntry(model_path):
356+
if self.archive_helper is not None:
357+
if self.archive_helper.contains_file(model_path):
358+
#
359+
# We cannot extract the files until the domain directory exists
360+
# so add them to the list so that they can be extracted after
361+
# domain creation completes.
362+
#
363+
self.files_to_extract_from_archive.append(model_path)
364+
else:
365+
path = self.alias_helper.get_model_folder_path(location)
366+
archive_file_name = self.model_context.get_archive_file_name
367+
ex = exception_helper.create_create_exception('WLSDPLY-12121', model_name, path,
368+
model_path, archive_file_name)
369+
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
370+
raise ex
371+
else:
372+
path = self.alias_helper.get_model_folder_path(location)
373+
ex = exception_helper.create_create_exception('WLSDPLY-12122', model_name, path, model_path)
374+
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
375+
raise ex
376+
353377
def _is_type_valid(self, location, type_name):
354378
"""
355379
Verify that the specified location in valid for the current WLS version.

0 commit comments

Comments
 (0)