Skip to content

Commit 5d97a5a

Browse files
committed
Issue #287 - Allow directory paths for domain libraries in model; validate path lists correctly
1 parent 0439065 commit 5d97a5a

File tree

4 files changed

+40
-14
lines changed

4 files changed

+40
-14
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
* The Universal Permissive License (UPL), Version 1.0
44
*/
55
package oracle.weblogic.deploy.util;
@@ -657,7 +657,7 @@ public List<String> listDomainLibLibraries() throws WLSDeployArchiveIOException
657657
/**
658658
* Extract the specified domain library to the specified location (e.g., $DOMAIN_HOME/lib).
659659
*
660-
* @param archivePath the name of the JAR to extract
660+
* @param archivePath the path of the library within the archive
661661
* @param extractToLocation the location to write the file
662662
* @throws WLSDeployArchiveIOException if an IOException occurred while extracting or writing the file
663663
* @throws IllegalArgumentException if the file or directory passed in does not exist
@@ -669,11 +669,7 @@ public void extractDomainLibLibrary(String archivePath, File extractToLocation)
669669
validateNonEmptyString(archivePath, "archivePath", METHOD);
670670
validateExistingDirectory(extractToLocation, "extractToLocation", getArchiveFileName(), METHOD);
671671

672-
String libPath = archivePath;
673-
if (!archivePath.startsWith(ARCHIVE_DOMLIB_TARGET_DIR)) {
674-
libPath = ARCHIVE_DOMLIB_TARGET_DIR + ZIP_SEP + archivePath;
675-
}
676-
extractFileFromZip(libPath, ARCHIVE_DOMLIB_TARGET_DIR, "", extractToLocation);
672+
extractFileFromZip(archivePath, ARCHIVE_DOMLIB_TARGET_DIR, "", extractToLocation);
677673
LOGGER.exiting(CLASS, METHOD);
678674
}
679675

core/src/main/python/wlsdeploy/tool/util/library_helper.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
5-
6-
import wlsdeploy.util.dictionary_utils as dictionary_utils
5+
from java.io import File
6+
from oracle.weblogic.deploy.util import WLSDeployArchive
7+
from shutil import copy
78

89
from wlsdeploy.aliases.model_constants import DOMAIN_LIBRARIES
9-
from wlsdeploy.aliases.model_constants import RCU_DB_INFO
1010
from wlsdeploy.exception import exception_helper
1111
from wlsdeploy.tool.util.alias_helper import AliasHelper
1212
from wlsdeploy.tool.util.archive_helper import ArchiveHelper
1313
from wlsdeploy.tool.util.wlst_helper import WlstHelper
1414

15+
import wlsdeploy.util.dictionary_utils as dictionary_utils
16+
1517

1618
class LibraryHelper(object):
1719
"""
@@ -51,9 +53,14 @@ def install_domain_libraries(self):
5153
raise ex
5254

5355
for domain_lib in domain_libs:
54-
self.logger.info('WLSDPLY-12215', domain_lib, self.domain_home,
55-
class_name=self.__class_name, method_name=_method_name)
56-
self.archive_helper.extract_domain_library(domain_lib)
56+
if WLSDeployArchive.isPathIntoArchive(domain_lib):
57+
self.logger.info('WLSDPLY-12215', domain_lib, self.domain_home,
58+
class_name=self.__class_name, method_name=_method_name)
59+
self.archive_helper.extract_domain_library(domain_lib)
60+
else:
61+
self.logger.info('WLSDPLY-12235', domain_lib, self.domain_home,
62+
class_name=self.__class_name, method_name=_method_name)
63+
self._copy_domain_library(domain_lib)
5764

5865
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
5966
return
@@ -78,3 +85,20 @@ def extract_classpath_libraries(self):
7885
class_name=self.__class_name, method_name=_method_name)
7986
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
8087
return
88+
89+
def _copy_domain_library(self, domain_lib):
90+
"""
91+
Copy the specified domain library to the domain's lib directory.
92+
:raises: BundleAwareException of the specified type: if an error occurs
93+
"""
94+
_method_name = '_copy_domain_library'
95+
96+
source_path = File(domain_lib).getAbsolutePath()
97+
target_dir = File(self.domain_home, 'lib').getPath()
98+
99+
try:
100+
copy(str(source_path), str(target_dir))
101+
except IOError:
102+
ex = exception_helper.create_create_exception('WLSDPLY-12234', source_path, target_dir)
103+
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
104+
raise ex

core/src/main/python/wlsdeploy/tool/validate/validator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,10 @@ def __validate_path_tokens_attribute(self, attribute_name, attribute_value, mode
889889
elif value_data_type == 'string':
890890
attr_values.append(attribute_value)
891891

892+
else:
893+
# must be a list
894+
attr_values.extend(attribute_value)
895+
892896
for item_path in attr_values:
893897
validation_result = self.__validate_single_path_in_archive(item_path.strip(), attribute_name,
894898
model_folder_path, validation_result)

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,8 @@ WLSDPLY-12230=Creating placeholder for Coherence cluster {0}
10231023
WLSDPLY-12231=Apply Domain {0} domain level attributes
10241024
WLSDPLY-12232=Unable to configure the SecurityConfiguration in domain release {0} using weblogic-deploy {1}
10251025
WLSDPLY-12233=Target JRF deployments and resources to {0} {1}
1026+
WLSDPLY-12234=Unable to copy domain library {0} to directory {1}
1027+
WLSDPLY-12235=Installing domain library {0} to lib directory of {1}
10261028

10271029
# domain_typedef.py
10281030
WLSDPLY-12300={0} got the domain type {1} but the domain type definition file {2} was not valid: {3}

0 commit comments

Comments
 (0)