|
17 | 17 | from wlsdeploy.aliases.model_constants import ODL_CONFIGURATION
|
18 | 18 | from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
|
19 | 19 | from wlsdeploy.aliases.wlst_modes import WlstModes
|
| 20 | +from wlsdeploy.exception import exception_helper |
20 | 21 | from wlsdeploy.logging.platform_logger import PlatformLogger
|
21 | 22 | from wlsdeploy.util import dictionary_utils
|
22 | 23 |
|
|
35 | 36 | _SERVERS = "Servers"
|
36 | 37 | _USE_PARENT_HANDLERS = "UseParentHandlers"
|
37 | 38 |
|
| 39 | +LOGGING_TEMPLATE_FILE = "logging-template.xml" |
| 40 | + |
38 | 41 |
|
39 | 42 | class OdlDeployer(object):
|
40 | 43 | """
|
@@ -100,10 +103,24 @@ def _update_server(self, name, dictionary, config_location):
|
100 | 103 | config_dir = File(self.model_context.get_domain_home(), CONFIG_DIR)
|
101 | 104 | server_dir = File(config_dir, name)
|
102 | 105 | config_file = File(server_dir, CONFIG_FILE)
|
| 106 | + log_template_dir = config_dir.getParentFile() |
103 | 107 |
|
104 | 108 | 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)) |
107 | 124 |
|
108 | 125 | # configure AddJvmNumber
|
109 | 126 | add_jvm_number = dictionary_utils.get_element(dictionary, _ADD_JVM_NUMBER)
|
|
0 commit comments