Skip to content

Commit

Permalink
Add support for different versions of datasource subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
marekkopecky committed Sep 10, 2024
1 parent ce08561 commit 5c1493a
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// security parameters used as elements: https://issues.redhat.com/browse/WFLY-18324
stringSubsystemValues = datasources.'@xmlns'.text().tokenize(":")[-1].tokenize(".")
major = stringSubsystemValues[0].toInteger()
minor = stringSubsystemValues[1].toInteger()
securityParamsAsElements = major <= 7 && minor < 2

// attributes of <datasource>
datasourceAttrs = ['pool-name': poolName]
if (nn(jta)) datasourceAttrs['jta'] = jta
Expand Down Expand Up @@ -45,9 +51,15 @@ def dsDefinition = {
}
if (nn(userName, password, securityDomain)) {
securityAttrs = [:]
if (nn(userName)) securityAttrs['user-name'] = userName
if (nn(password)) securityAttrs['password'] = password
if (!securityParamsAsElements) { // see https://issues.redhat.com/browse/WFLY-18324
if (nn(userName)) securityAttrs['user-name'] = userName
if (nn(password)) securityAttrs['password'] = password
}
security(securityAttrs) {
if (securityParamsAsElements) { // 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 5c1493a

Please sign in to comment.