From 5f3fbd9ed94a2abae8392a977721a3dd6d1d7006 Mon Sep 17 00:00:00 2001 From: Emmanuel Hugonnet Date: Fri, 1 Mar 2024 15:52:18 +0100 Subject: [PATCH] [(nobranch,rebasingWFCORE-6503)]: [WFCORE-6503]: Adding warning if YAML is adding an existing resource without any attribute. Signed-off-by: Emmanuel Hugonnet --- .../java/org/jboss/as/controller/logging/ControllerLogger.java | 2 +- .../controller/persistence/yaml/YamlConfigurationExtension.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 90de51d9bfc..78ab8c6e9a3 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 @@ -3682,7 +3682,7 @@ OperationFailedRuntimeException capabilityAlreadyRegisteredInContext(String capa IllegalArgumentException noResourceForUndefiningAttribute(String attribute, String address); @LogMessage(level = WARN) - @Message(id = 490, value = "You have defined a resource for address %s without any attributes, doing nothing") + @Message(id = 490, value = " A YAML resource has been defined for the address %s without any attributes. No actions will be taken.") void noAttributeSetForAddress(String address); @LogMessage(level = WARN) 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 8577476ee56..d1e20dee0e9 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 @@ -241,6 +241,8 @@ private void processResource(PathAddress parentAddress, Map yaml //we are processing an attribute: MGMT_OP_LOGGER.debugf("We are processing the attribute %s for address %s", name, address.getParent().toCLIStyleString()); processAttribute(parentAddress, rootRegistration, name, value, postExtensionOps, xmlOperations); + } else if (value == null) { + MGMT_OP_LOGGER.noAttributeSetForAddress(address.toCLIStyleString()); } } } else {