diff --git a/core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java b/core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java index 250887262..6fe92e616 100644 --- a/core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java +++ b/core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java @@ -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. * diff --git a/core/src/main/python/wlsdeploy/tool/create/creator.py b/core/src/main/python/wlsdeploy/tool/create/creator.py index 330547598..915fa41dd 100644 --- a/core/src/main/python/wlsdeploy/tool/create/creator.py +++ b/core/src/main/python/wlsdeploy/tool/create/creator.py @@ -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) @@ -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.