Skip to content

Issue #344 - Skip classpath libraries in attribute archive extraction… #351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ public static boolean isPathIntoArchive(String path) {
return result;
}

/**
* Determine if the specified path is in the classpath libraries folder.
* This includes the case where the specified path is the classpath libraries folder.
* @param path the path to be checked
* @return true if the specified path matches or is under the classpath libraries folder
*/
public static boolean isClasspathEntry(String path) {
return path.startsWith(ARCHIVE_CPLIB_TARGET_DIR);
}

/**
* Get the current file name for the JCSLifecycleArchive file.
*
Expand Down
66 changes: 45 additions & 21 deletions core/src/main/python/wlsdeploy/tool/create/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,27 +307,8 @@ def _set_attribute(self, location, model_name, model_value, uses_path_tokens_nam
"""
_method_name = '_set_attribute'

if model_name in uses_path_tokens_names and WLSDeployArchive.isPathIntoArchive(model_value):
if self.archive_helper is not None:
if self.archive_helper.contains_file(model_value):
#
# We cannot extract the files until the domain directory exists
# so add them to the list so that they can be extracted after
# domain creation completes.
#
self.files_to_extract_from_archive.append(model_value)
else:
path = self.alias_helper.get_model_folder_path(location)
archive_file_name = self.model_context.get_archive_file_name
ex = exception_helper.create_create_exception('WLSDPLY-12121', model_name, path,
model_value, archive_file_name)
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
raise ex
else:
path = self.alias_helper.get_model_folder_path(location)
ex = exception_helper.create_create_exception('WLSDPLY-12122', model_name, path, model_value)
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
raise ex
if (model_name in uses_path_tokens_names) and (model_value is not None):
self._extract_archive_files(location, model_name, model_value)

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

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

def _extract_archive_files(self, location, model_name, model_value):
"""
Extract any archive files associated with the specified model attribute value.
The attribute has already been determined to use path tokens.
:param location: the location of the attribute
:param model_name: the model attribute name
:param model_value: the model attribute value
:raises: CreateException: if an error occurs
"""
_method_name = '_extract_archive_files'

# model value should be a list, comma-delimited string, or string
model_paths = model_value
if isinstance(model_value, str):
model_paths = model_value.split(',')

for model_path in model_paths:
model_path = model_path.strip()

# check for path starting with "wlsdeploy/".
# skip classpath libraries, they are extracted elsewhere.
if WLSDeployArchive.isPathIntoArchive(model_path) and not WLSDeployArchive.isClasspathEntry(model_path):
if self.archive_helper is not None:
if self.archive_helper.contains_file(model_path):
#
# We cannot extract the files until the domain directory exists
# so add them to the list so that they can be extracted after
# domain creation completes.
#
self.files_to_extract_from_archive.append(model_path)
else:
path = self.alias_helper.get_model_folder_path(location)
archive_file_name = self.model_context.get_archive_file_name
ex = exception_helper.create_create_exception('WLSDPLY-12121', model_name, path,
model_path, archive_file_name)
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
raise ex
else:
path = self.alias_helper.get_model_folder_path(location)
ex = exception_helper.create_create_exception('WLSDPLY-12122', model_name, path, model_path)
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
raise ex

def _is_type_valid(self, location, type_name):
"""
Verify that the specified location in valid for the current WLS version.
Expand Down