puppet-wildfly
puppet-wildfly copied to clipboard
CLI command always runs even when test is false
Hi,
Looking at the issues list I've encountered the issue where the KeycloakDS datasource can't be changed because of the expression on the jdbc URL.
Trying to bypass this issue, I've tried removing the old H2 datasource and create it again but only if the driver is set to h2 using:
wildfly::cli { 'Remove old KeycloakDS':
command => '/profile=auth-server-clustered/subsystem=datasources/data-source=KeycloakDS:remove',
unless => '(driver-name == h2) of /profile=auth-server-clustered/subsystem=datasources/data-source=KeycloakDS:read-attribute(name=driver-name)',
}
But every time I do a puppet run the cli command runs even tho the driver-name is no longer h2.
before:
/profile=auth-server-clustered/subsystem=datasources/data-source=KeycloakDS:read-attribute(name=driver-name) { "outcome" => "success", "result" => "h2" }
after:
/profile=auth-server-clustered/subsystem=datasources/data-source=KeycloakDS:read-attribute(name=driver-name) { "outcome" => "success", "result" => "mysql" }
Is that a supported way to do "unless" ?
Is there another way to run a CLI command where it tests for a specific value of the resource?
You should be able to do it with:
wildfly::cli { 'Remove old KeycloakDS':
command => '/profile=auth-server-clustered/subsystem=datasources/data-source=KeycloakDS:remove',
unless => '(result == h2) of /profile=auth-server-clustered/subsystem=datasources/data-source=KeycloakDS:read-attribute(name=driver-name)',
}
In fact, if I understood correct. You'd need onlyif instead of unless.