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 f243173ba33..52aeb092749 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 @@ -45,6 +45,7 @@ import org.jboss.as.controller.MapAttributeDefinition; import org.jboss.as.controller.ObjectMapAttributeDefinition; import org.jboss.as.controller.ObjectTypeAttributeDefinition; +import org.jboss.as.controller.ParallelBootOperationStepHandler; import org.jboss.as.controller.ParsedBootOp; import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.RunningMode; @@ -160,13 +161,24 @@ public void processOperations(ImmutableManagementResourceRegistration rootRegist } MGMT_OP_LOGGER.debug("We are applying YAML files to the configuration"); Map xmlOperations = new HashMap<>(); + ParsedBootOp parallelBootOp = null; for (ParsedBootOp op : postExtensionOps) { - if (op.getChildOperations().isEmpty()) { + List childOperations = op.getChildOperations(); + if (childOperations.isEmpty()) { xmlOperations.put(op.getAddress(), op); } else { - for (ModelNode childOp : op.getChildOperations()) { - ParsedBootOp subOp = new ParsedBootOp(childOp, null); - xmlOperations.put(subOp.getAddress(), subOp); + if (op.handler instanceof ParallelBootOperationStepHandler) { + parallelBootOp = new ParsedBootOp(op, op.handler); + for (ModelNode childOp : childOperations) { + ParsedBootOp subOp = new ParsedBootOp(childOp, null); + xmlOperations.put(subOp.getAddress(), subOp); + parallelBootOp.addChildOperation(subOp); + } + } else { + for (ModelNode childOp : childOperations) { + ParsedBootOp subOp = new ParsedBootOp(childOp, null); + xmlOperations.put(subOp.getAddress(), subOp); + } } } } @@ -176,6 +188,18 @@ public void processOperations(ImmutableManagementResourceRegistration rootRegist for (Map.Entry deployment : deployments.entrySet()) { processUnmanagedDeployments(rootRegistration, deployment, xmlOperations, postExtensionOps); } + List reorderedList = new ArrayList<>(postExtensionOps.size()); + for (ParsedBootOp op : postExtensionOps) { + if (parallelBootOp != null && op.getAddress().size() > 0 && "subsystem".equals(op.getAddress().getElement(0).getKey())) { + parallelBootOp.addChildOperation(op); + } else if (op.handler instanceof ParallelBootOperationStepHandler) { + reorderedList.add(parallelBootOp); + } else { + reorderedList.add(op); + } + } + postExtensionOps.clear(); + postExtensionOps.addAll(reorderedList); this.configs.clear(); needReload = true; } @@ -424,7 +448,7 @@ private void processAttributes(PathAddress address, ImmutableManagementResourceR } } for (AttributeDefinition def : operationEntry.getOperationDefinition().getParameters()) { - if (def != null && ! attributeNames.contains(def.getName())) { + if (def != null && !attributeNames.contains(def.getName())) { if (!def.isResourceOnly()) { attributes.add(def); } diff --git a/testsuite/manualmode/src/test/java/org/jboss/as/test/manualmode/management/persistence/yaml/YamlExtensionTestCase.java b/testsuite/manualmode/src/test/java/org/jboss/as/test/manualmode/management/persistence/yaml/YamlExtensionTestCase.java index 00c33932546..8e4901b272e 100644 --- a/testsuite/manualmode/src/test/java/org/jboss/as/test/manualmode/management/persistence/yaml/YamlExtensionTestCase.java +++ b/testsuite/manualmode/src/test/java/org/jboss/as/test/manualmode/management/persistence/yaml/YamlExtensionTestCase.java @@ -433,7 +433,7 @@ public void testYamlOperations() throws Exception { result = Operations.readResult(client.execute(Operations.createReadResourceOperation(PathAddress.pathAddress("subsystem", "elytron").toModelNode(), true))); Assert.assertEquals("Yaml operation to undefine disallowed-providers was not executed.", "undefined", result.get("disallowed-providers").asString()); ModelNode permissions = result.get("permission-set").get("default-permissions").get("permissions"); - Assert.assertEquals("Yaml change to port set mail-smtp outbound socket binding is wrong", "[{\"class-name\" => \"org.wildfly.security.auth.permission.LoginPermission\",\"module\" => \"org.wildfly.security.elytron-base\",\"target-name\" => \"*\"}]", permissions.asString()); + Assert.assertEquals("Yaml change to set default permissions is wrong", "[{\"class-name\" => \"org.wildfly.security.auth.permission.LoginPermission\",\"module\" => \"org.wildfly.security.elytron-base\",\"target-name\" => \"*\"}]", permissions.asString()); } @Test