diff --git a/controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java b/controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java index b515c1bceb4..90de51d9bfc 100644 --- a/controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java +++ b/controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java @@ -3755,4 +3755,10 @@ OperationFailedRuntimeException capabilityAlreadyRegisteredInContext(String capa @Message(id = 505, value = "Unsuported deployment yaml file %s with attributes %s") IllegalArgumentException unsupportedDeployment(String deployment, Set attribues); + + @Message(id = 506, value = "The yaml element \"%s\" and its sub-elements are ignored.") + String ignoreYamlElement(String element); + + @Message(id = NONE, value = "Thus ignoring element \"%s\".") + String ignoreYamlSubElement(String element); } diff --git a/controller/src/main/java/org/jboss/as/controller/persistence/yaml/YamlConfigurationExtension.java b/controller/src/main/java/org/jboss/as/controller/persistence/yaml/YamlConfigurationExtension.java index a5c1c443e54..8577476ee56 100644 --- a/controller/src/main/java/org/jboss/as/controller/persistence/yaml/YamlConfigurationExtension.java +++ b/controller/src/main/java/org/jboss/as/controller/persistence/yaml/YamlConfigurationExtension.java @@ -103,8 +103,8 @@ private void load() { for (Path file : files) { if (file != null && Files.exists(file) && Files.isRegularFile(file)) { Map yamlConfig = Collections.emptyMap(); + Yaml yaml = new Yaml(new OperationConstructor(new LoaderOptions())); try (InputStream inputStream = Files.newInputStream(file)) { - Yaml yaml = new Yaml(new OperationConstructor(new LoaderOptions())); yamlConfig = yaml.load(inputStream); } catch (IOException ioex) { throw MGMT_OP_LOGGER.failedToParseYamlConfigurationFile(file.toAbsolutePath().toString(), ioex); @@ -112,9 +112,16 @@ private void load() { if (yamlConfig.containsKey(CONFIGURATION_ROOT_KEY)) { Map config = (Map) yamlConfig.get(CONFIGURATION_ROOT_KEY); for (String excluded : EXCLUDED_ELEMENTS) { + boolean isPresent = config.containsKey(excluded); Object value = config.remove(excluded); if(value != null && value instanceof Map && DEPLOYMENT.equals(excluded)) { deployments.putAll((Map) value); + } else if (isPresent) { + String message = MGMT_OP_LOGGER.ignoreYamlElement(excluded); + if(value != null) { + message = message + MGMT_OP_LOGGER.ignoreYamlSubElement(yaml.dump(value).trim()); + } + MGMT_OP_LOGGER.warn(message); } } parsedFiles.add(file.toAbsolutePath().toString());