Skip to content

Commit 1927a87

Browse files
Merge pull request #220 from oracle/jira-wdt-40-custom-ssl-configuration
JIRA WDT-40 Store node manager keystore file separately in archive
2 parents fd67130 + da6534b commit 1927a87

File tree

3 files changed

+81
-12
lines changed

3 files changed

+81
-12
lines changed

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

+24
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ public class WLSDeployArchive {
7474
*/
7575
public static final String ARCHIVE_COHERENCE_TARGET_DIR = WLSDPLY_ARCHIVE_BINARY_DIR + "/coherence";
7676

77+
/**
78+
* The subdirectory where node manager files are stored and extracted (such as keystore file).
79+
*/
80+
public static final String ARCHIVE_NODE_MANAGER_TARGET_DIR = WLSDPLY_ARCHIVE_BINARY_DIR + "/nodeManager";
81+
7782
/**
7883
* The subdirectory to which the scripts are extracted.
7984
*/
@@ -867,6 +872,25 @@ public String addFileStoreDirectory(String fileStoreName) throws
867872
return newName;
868873
}
869874

875+
/**
876+
* Add a Node Manager Identity Key Store file to the node manager directory in the archive.
877+
*
878+
* @param keystoreFile the file to add
879+
* @return the new location of the file to use in the model
880+
* @throws WLSDeployArchiveIOException if an error occurs while archiving the file
881+
* @throws IllegalArgumentException if the file does not exist
882+
*/
883+
public String addNodeManagerKeyStoreFile(File keystoreFile) throws WLSDeployArchiveIOException {
884+
final String METHOD = "addNodeManagerKeyStoreFile";
885+
886+
LOGGER.entering(CLASS, METHOD, keystoreFile);
887+
888+
validateExistingFile(keystoreFile, "keyStoreFile", getArchiveFileName(), METHOD);
889+
String newName = addItemToZip(ARCHIVE_NODE_MANAGER_TARGET_DIR, keystoreFile);
890+
LOGGER.exiting(CLASS, METHOD, newName);
891+
return newName;
892+
}
893+
870894
/**
871895
* This method removes all binaries from the archive. This method is intended to
872896
* be invoked by discovery to remove binaries from a previous run that might

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

+54-12
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ def _add_library(self, server_name, classpath_name):
578578

579579
def _add_keystore_file_to_archive(self, model_name, model_value, location):
580580
"""
581-
Add the Server custom trust or identity keystore file to the archive.
581+
Add the custom trust or identity keystore file to the archive.
582582
:param model_name: attribute name in the model
583583
:param model_value: converted model value for the attribute
584584
:param location: context containing the current location information
@@ -591,20 +591,62 @@ def _add_keystore_file_to_archive(self, model_name, model_value, location):
591591
server_name = self._get_server_name_from_location(location)
592592
archive_file = self._model_context.get_archive_file()
593593
file_path = self._convert_path(model_value)
594-
_logger.finer('WLSDPLY-06623', file_path, server_name, class_name=_class_name, method_name=_method_name)
595-
try:
596-
new_name = archive_file.addServerKeyStoreFile(server_name, File(file_path))
597-
except IllegalArgumentException, iae:
598-
_logger.warning('WLSDPLY-06624', server_name, file_path, iae.getLocalizedMessage(),
599-
class_name=_class_name, method_name=_method_name)
600-
except WLSDeployArchiveIOException, wioe:
601-
de = exception_helper.create_discover_exception('WLSDPLY-06625', server_name, file_path,
602-
wioe.getLocalizedMessage())
603-
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
604-
raise de
594+
if server_name:
595+
new_name = self._add_server_keystore_file_to_archive(server_name, archive_file, file_path)
596+
else:
597+
new_name = self._add_node_manager_keystore_file_to_archive(archive_file, file_path)
598+
605599
_logger.exiting(class_name=_class_name, method_name=_method_name, result=new_name)
606600
return new_name
607601

602+
def _add_server_keystore_file_to_archive(self, server_name, archive_file, file_path):
603+
"""
604+
Add the Server custom trust or identity keystore file to the archive.
605+
:param server_name: attribute name in the model
606+
:param archive_file: converted model value for the attribute
607+
:param file_path: context containing the current location information
608+
:return: modified location and name for the model keystore file
609+
"""
610+
_method_name = '_add_server_keystore_file_to_archive'
611+
_logger.entering(server_name, archive_file, file_path, class_name=_class_name, method_name=_method_name)
612+
_logger.finer('WLSDPLY-06623', file_path, server_name, class_name=_class_name, method_name=_method_name)
613+
new_name = None
614+
615+
try:
616+
new_name = archive_file.addServerKeyStoreFile(server_name, File(file_path))
617+
except IllegalArgumentException, iae:
618+
_logger.warning('WLSDPLY-06624', server_name, file_path, iae.getLocalizedMessage(),
619+
class_name=_class_name, method_name=_method_name)
620+
except WLSDeployArchiveIOException, wioe:
621+
de = exception_helper.create_discover_exception('WLSDPLY-06625', server_name, file_path,
622+
wioe.getLocalizedMessage())
623+
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
624+
raise de
625+
return new_name
626+
627+
def _add_node_manager_keystore_file_to_archive(self, archive_file, file_path):
628+
"""
629+
Add the node manager custom trust or identity keystore file to the archive.
630+
:param archive_file: converted model value for the attribute
631+
:param file_path: context containing the current location information
632+
:return: modified location and name for the model keystore file
633+
"""
634+
_method_name = '_add_node_manager_keystore_file_to_archive'
635+
_logger.entering(archive_file, file_path, class_name=_class_name, method_name=_method_name)
636+
_logger.finer('WLSDPLY-06636', file_path, class_name=_class_name, method_name=_method_name)
637+
new_name = None
638+
639+
try:
640+
new_name = archive_file.addNodeManagerKeyStoreFile(File(file_path))
641+
except IllegalArgumentException, iae:
642+
_logger.warning('WLSDPLY-06637', file_path, iae.getLocalizedMessage(), class_name=_class_name,
643+
method_name=_method_name)
644+
except WLSDeployArchiveIOException, wioe:
645+
de = exception_helper.create_discover_exception('WLSDPLY-06638', file_path, wioe.getLocalizedMessage())
646+
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
647+
raise de
648+
return new_name
649+
608650
def _get_server_name_from_location(self, location):
609651
"""
610652
Retrieve the server name from the location context file.

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

+3
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,9 @@ WLSDPLY-06632=Discovering {0} XML Entity Caches
616616
WLSDPLY-06633=Adding XML Entity Cache{0}
617617
WLSDPLY-06634=Discovering {0} XML Registries
618618
WLSDPLY-06635=Adding XML Registry {0}
619+
WLSDPLY-06636=Adding keystore file {0} for node manager to archive file
620+
WLSDPLY-06637=Unable to locate and add node manager keystore file {0} to the archive file : {1}
621+
WLSDPLY-06638=Unexpected exception attempting to add node manager keystore file {0} to the archive : {1}
619622

620623
# multi_tenant_discoverer.py, multi_tenant_resources_dsi
621624
WLSDPLY-06700=Discover Multi-tenant

0 commit comments

Comments
 (0)