Skip to content

Commit

Permalink
Introduce server version detection in AddDatasource offline command
Browse files Browse the repository at this point in the history
  • Loading branch information
marekkopecky committed Sep 10, 2024
1 parent ce08561 commit 154bdf9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ public final void apply(OfflineCommandContext ctx) throws CommandFailedException
.parameter("enableAfterCreation", enableAfterCreation)
.parameter("replaceExisting", replaceExisting)

.parameter("serverVersion", ctx.version)

.build();

ctx.client.apply(transform);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.wildfly.extras.creaper.core.ServerVersion

// attributes of <datasource>
datasourceAttrs = ['pool-name': poolName]
if (nn(jta)) datasourceAttrs['jta'] = jta
Expand Down Expand Up @@ -45,9 +47,15 @@ def dsDefinition = {
}
if (nn(userName, password, securityDomain)) {
securityAttrs = [:]
if (nn(userName)) securityAttrs['user-name'] = userName
if (nn(password)) securityAttrs['password'] = password
if (serverVersion.greaterThanOrEqualTo(ServerVersion.VERSION_23_0_0)) { // see https://issues.redhat.com/browse/WFLY-18324
if (nn(userName)) securityAttrs['user-name'] = userName
if (nn(password)) securityAttrs['password'] = password
}
security(securityAttrs) {
if (serverVersion.lessThan(ServerVersion.VERSION_23_0_0)) { // see https://issues.redhat.com/browse/WFLY-18324
if (nn(userName)) 'user-name'(userName)
if (nn(password)) 'password'(password)
}
if (nn(securityDomain)) 'security-domain'(securityDomain)
}
}
Expand Down

0 comments on commit 154bdf9

Please sign in to comment.