Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI command always runs even when test is false #209

Open
aledesmablvd opened this issue Jul 3, 2017 · 2 comments
Open

CLI command always runs even when test is false #209

aledesmablvd opened this issue Jul 3, 2017 · 2 comments

Comments

@aledesmablvd
Copy link

aledesmablvd commented Jul 3, 2017

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?

@jairojunior
Copy link
Collaborator

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)',
}

@jairojunior
Copy link
Collaborator

In fact, if I understood correct. You'd need onlyif instead of unless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants