I have an AddStepHandler that adds a keycloak server to the management
model using the "Mixed Approach"[1]. It also needs to add overlay
content if any new content is available. The overlay itself already
exists in standalone.xml.
<deployment-overlays>
<deployment-overlay
name="main-auth-server.war-keycloak-overlay">
<deployment name="main-auth-server.war"/>
</deployment-overlay>
</deployment-overlays>
I insert this operation in my AddStepHandler:
{
"operation" => "add",
"address" => [
("deployment-overlay" =>
"main-auth-server.war-keycloak-overlay"),
("content" =>
"/WEB-INF/classes/META-INF/keycloak-server.json")
],
"content" => {"url" =>
"file:/mydir/keycloak-server.json"},
"rollback-on-runtime-failure" => false
}
But at this point in server startup, the overlay's add handler hasn't
bee called. So I get
14:09:20,729 ERROR [org.jboss.as.controller.management-operation]
(ServerService Thread Pool -- 26) JBAS014613: Operation ("add") failed -
address: ([
("deployment-overlay" =>
"main-auth-server.war-keycloak-overlay"),
("content" =>
"/WEB-INF/classes/META-INF/keycloak-server.json")
]) - failure description: "JBAS014766: Resource [(\"deployment-overlay\"
=> \"main-auth-server.war-keycloak-overlay\")] does not exist; a
resource at address [
(\"deployment-overlay\" =>
\"main-auth-server.war-keycloak-overlay\"),
(\"content\" =>
\"/WEB-INF/classes/META-INF/keycloak-server.json\")
] cannot be created until all ancestor resources have been added"
At startup, how can I make sure that my "add overlay content" operation
is executed after "add overlay" is done?
[1]
https://developer.jboss.org/wiki/ExtendingAS7