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

Attributes with expression value do not work #204

Open
alexjfisher opened this issue Jun 21, 2017 · 1 comment
Open

Attributes with expression value do not work #204

alexjfisher opened this issue Jun 21, 2017 · 1 comment
Labels

Comments

@alexjfisher
Copy link
Member

Hi

When I try to update the default keycloak standalone-ha database, the code explodes when trying to compare the is and should values.

wildfly::datasources::datasource { 'KeycloakDS':
  config  => {
    'driver-name'    => 'oracle',
    'user-name'      => 'keycloak',
    'password'       => 'password,
    'jndi-name'      => 'java:jboss/datasources/KeycloakDS',
    'connection-url' => 'jdbc:oracle:thin:@//host:1521/sid',
  },
  notify   => Wildfly::Reload['Reload if necessary'],
  require  => Wildfly::Datasources::Driver['Oracle driver'],
}
Error: undefined method `keys' for "jdbc:oracle:thin:@//host:1521/sid":String
/opt/puppetlabs/puppet/cache/lib/puppet_x/wildfly/deep_hash.rb:8:in `block in _deep_intersect'
/opt/puppetlabs/puppet/cache/lib/puppet_x/wildfly/deep_hash.rb:7:in `each'
/opt/puppetlabs/puppet/cache/lib/puppet_x/wildfly/deep_hash.rb:7:in `_deep_intersect'
/opt/puppetlabs/puppet/cache/lib/puppet_x/wildfly/deep_hash.rb:10:in `block in _deep_intersect'
/opt/puppetlabs/puppet/cache/lib/puppet_x/wildfly/deep_hash.rb:7:in `each'
/opt/puppetlabs/puppet/cache/lib/puppet_x/wildfly/deep_hash.rb:7:in `_deep_intersect'
/opt/puppetlabs/puppet/cache/lib/puppet_x/wildfly/deep_hash.rb:38:in `insync?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property.rb:277:in `safe_insync?'
Error: /Stage[main]/Profile::Keycloak/Wildfly::Datasources::Datasource[KeycloakDS]/Wildfly::Resource[/subsystem=datasources/data-source=KeycloakDS]/Wildfly_resource[/subsystem=datasources/data-source=KeycloakDS]/state: change from {"allocation-retry"=>nil, "allocation-retry-wait-millis"=>nil, "allow-multiple-users"=>false, "background-validation"=>nil, "background-validation-millis"=>nil, "blocking-timeout-wait-millis"=>nil, "capacity-decrementer-class"=>nil, "capacity-decrementer-properties"=>nil, "capacity-incrementer-class"=>nil, "capacity-incrementer-properties"=>nil, "check-valid-connection-sql"=>nil, "connectable"=>false, "connection-listener-class"=>nil, "connection-listener-property"=>nil, "connection-url"=>{"EXPRESSION_VALUE"=>"jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE"}, "datasource-class"=>nil, "driver-class"=>nil, "driver-name"=>"h2", "enabled"=>true, "enlistment-trace"=>true, "exception-sorter-class-name"=>nil, "exception-sorter-properties"=>nil, "flush-strategy"=>nil, "idle-timeout-minutes"=>nil, "initial-pool-size"=>nil, "jndi-name"=>"java:jboss/datasources/KeycloakDS", "jta"=>true, "max-pool-size"=>nil, "mcp"=>"org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool", "min-pool-size"=>nil, "new-connection-sql"=>nil, "password"=>"sa", "pool-fair"=>nil, "pool-prefill"=>nil, "pool-use-strict-min"=>nil, "prepared-statements-cache-size"=>nil, "query-timeout"=>nil, "reauth-plugin-class-name"=>nil, "reauth-plugin-properties"=>nil, "security-domain"=>nil, "set-tx-query-timeout"=>false, "share-prepared-statements"=>false, "spy"=>false, "stale-connection-checker-class-name"=>nil, "stale-connection-checker-properties"=>nil, "statistics-enabled"=>false, "track-statements"=>"NOWARN", "tracking"=>false, "transaction-isolation"=>nil, "url-delimiter"=>nil, "url-selector-strategy-class-name"=>nil, "use-ccm"=>true, "use-fast-fail"=>false, "use-java-context"=>true, "use-try-lock"=>nil, "user-name"=>"sa", "valid-connection-checker-class-name"=>nil, "valid-connection-checker-properties"=>nil, "validate-on-match"=>nil, "connection-properties"=>nil, "statistics"=>{"pool"=>nil, "jdbc"=>nil}} to {"driver-name"=>"oracle", "user-name"=>"keycloak", "password"=>"password", "jndi-name"=>"java:jboss/datasources/KeycloakDS", "connection-url"=>"jdbc:oracle:thin:@//host:1521/sid"} failed: undefined method `keys' for "jdbc:oracle:thin:@//host:1521/sid":String

I think this happens because the original connection-url is jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE and the API returns this as a hash, not a simple string?

"connection-url"=> {
  "EXPRESSION_VALUE"=>"jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE"
}

This causes keys to be called on a string in _deep_intersect here

I'm new to this module, but I think this might be a recent regression introduced in dc0771f

@jairojunior
Copy link
Collaborator

Your assumptions are right. Just read interfaces through Management API and it returned:

"inet-address" : { "EXPRESSION_VALUE" : "${jboss.bind.address.management:127.0.0.1}" }

Merged your PR, it fixes this error, but it's not enough. Attributes with expression values will change every run.

I'll add this resource to the first standalone spec:

wildfly::resource { '/subsystem=webservices':
  content => {
    'wsdl-host' => "\${jboss.bind.address:${facts['hostname']}}",
  },
}

And will only close this issue when acceptance tests are passing 😄

@jairojunior jairojunior reopened this Jun 23, 2017
@jairojunior jairojunior changed the title Error: undefined method `keys' for "jdbc:oracle:thin:@//host:1521/sid":String Attributes with expression value do not work Jun 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants