Skip to content

Commit e54c6fe

Browse files
authored
Enable ODL configuration for dynamic servers (#736)
* Use logging configuration template to configure ODL when server has not been created * Throw a deploy exception if directory can't be created
1 parent 9ff7597 commit e54c6fe

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

core/src/main/python/wlsdeploy/tool/deploy/odl_deployer.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from wlsdeploy.aliases.model_constants import ODL_CONFIGURATION
1818
from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
1919
from wlsdeploy.aliases.wlst_modes import WlstModes
20+
from wlsdeploy.exception import exception_helper
2021
from wlsdeploy.logging.platform_logger import PlatformLogger
2122
from wlsdeploy.util import dictionary_utils
2223

@@ -35,6 +36,8 @@
3536
_SERVERS = "Servers"
3637
_USE_PARENT_HANDLERS = "UseParentHandlers"
3738

39+
LOGGING_TEMPLATE_FILE = "logging-template.xml"
40+
3841

3942
class OdlDeployer(object):
4043
"""
@@ -100,10 +103,24 @@ def _update_server(self, name, dictionary, config_location):
100103
config_dir = File(self.model_context.get_domain_home(), CONFIG_DIR)
101104
server_dir = File(config_dir, name)
102105
config_file = File(server_dir, CONFIG_FILE)
106+
log_template_dir = config_dir.getParentFile()
103107

104108
try:
105-
FileUtils.validateWritableFile(config_file.getPath())
106-
document = LoggingConfigurationDocument(FileInputStream(config_file))
109+
if config_file.exists():
110+
source_file = config_file
111+
FileUtils.validateWritableFile(config_file.getPath())
112+
else:
113+
# for dynamic servers, the logging config does not exist until the server is started.
114+
# read the from template file, verify that the server directory is present and writable.
115+
source_file = File(log_template_dir, LOGGING_TEMPLATE_FILE)
116+
FileUtils.validateExistingFile(source_file)
117+
if not server_dir.exists() and not server_dir.mkdirs():
118+
ex = exception_helper.create_deploy_exception('WLSDPLY-19710', server_dir)
119+
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
120+
raise ex
121+
FileUtils.validateWritableDirectory(server_dir.getPath())
122+
123+
document = LoggingConfigurationDocument(FileInputStream(source_file))
107124

108125
# configure AddJvmNumber
109126
add_jvm_number = dictionary_utils.get_element(dictionary, _ADD_JVM_NUMBER)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,7 @@ WLSDPLY-19706=Unable to set property {0} to "{1}" at location {2}: {3}
15051505
WLSDPLY-19707=Unable to update ODL configuration for server {0}: {1}
15061506
WLSDPLY-19708=Applying {0} {1} to server {2}
15071507
WLSDPLY-19709=ODL configuration for non-JRF domains is not supported, skipping
1508+
WLSDPLY-19710=Unable to create logging configuration directory {0}
15081509

15091510
# Common tooling messages used by multiple tools
15101511
WLSDPLY-20000={0} encountered an unexpected validation error: {1}

0 commit comments

Comments
 (0)