rhtconsulting / puppet-jboss_admin

Puppet module for runtime configuration of a JBoss container
MIT License
15 stars 12 forks source link

sometimes numbers need to be quoted and sometimes they do not, causes puppet to always run #30

Open itewk opened 9 years ago

itewk commented 9 years ago

Every time I run puppet it thinks my idle-timeout-minutes is changing:

Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ifw]/Jboss_admin::Resource::Data_source[/subsystem=datasources/data-source=ifwPOOL]/Jboss_resource[/subsystem=datasources/data-source=ifwPOOL]/options: options changed '{"idle-timeout-minutes"=>"5"}' to '{"idle-timeout-minutes"=>5}'

I found the convert_ints_to_strings function in jboss_admin/lib/puppet/util/cli_execution.rb but have not yet figured out why it does not seem to be working in this case.

itewk commented 9 years ago

If i comment out the convert_ints_to_strings then I end up with this:

Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ifw]/Jboss_admin::Resource::Data_source[/subsystem=datasources/data-source=ifwPOOL]/Jboss_resource[/subsystem=datasources/data-source=ifwPOOL]/options: options changed '{"blocking-timeout-wait-millis"=>50000, "use-try-lock"=>60000, "prepared-statements-cache-size"=>0, "min-pool-size"=>10, "query-timeout"=>0, "max-pool-size"=>75, "allocation-retry"=>0, "allocation-retry-wait-millis"=>5000}' to '{"blocking-timeout-wait-millis"=>"50000", "use-try-lock"=>"60000", "prepared-statements-cache-size"=>"0", "min-pool-size"=>"10", "query-timeout"=>"0", "allocation-retry"=>"0", "max-pool-size"=>"75", "allocation-retry-wait-millis"=>"5000"}'

What this is telling me is that for some reason the idle-timeout-minutes "should" value should be a string, but is a number, and not sure why yet.

itewk commented 9 years ago

This is just weird, going to do my best to try and describe what is going on.

I have a hash that I use to call create_resource to create a custome datasource add type (which then calls the jboss_admin data_source type) with the information for defining a data source.

I do not have problems if I pass:

MyDSName:
  idle_timeout_minutes: '10'

But I do have problems if I pass:

MyDSName:
  idle_timeout_minutes: 10

In both cases the values of is_numeric, is_string, and is_integer are all the same:

Notice: [value=10] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ITNT-DS]/Notify[ITNT-DS: min_pool_size]/message: defined 'message' as '[value=10] [is_integer=true] [is_numberic=true] [is_string=false]'
Notice: [value=10] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ifwdms]/Notify[ifwdms: min_pool_size]/message: defined 'message' as '[value=10] [is_integer=true] [is_numberic=true] [is_string=false]'
Notice: [value=75] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ifwdms]/Notify[ifwdms: max_pool_size]/message: defined 'message' as '[value=75] [is_integer=true] [is_numberic=true] [is_string=false]'
Notice: [value=5] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ifwdms]/Notify[ifwdms: idle_timeout_minutes]/message: defined 'message' as '[value=5] [is_integer=true] [is_numberic=true] [is_string=false]'
Notice: [value=50] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ITNT-DS]/Notify[ITNT-DS: max_pool_size]/message: defined 'message' as '[value=50] [is_integer=true] [is_numberic=true] [is_string=false]'
Notice: [value=120] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ITNT-DS]/Notify[ITNT-DS: idle_timeout_minutes]/message: defined 'message' as '[value=120] [is_integer=true] [is_numberic=true] [is_string=false]'
Notice: [value=10] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ifw]/Notify[ifw: min_pool_size]/message: defined 'message' as '[value=10] [is_integer=true] [is_numberic=true] [is_string=false]'
Notice: [value=75] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ifw]/Notify[ifw: max_pool_size]/message: defined 'message' as '[value=75] [is_integer=true] [is_numberic=true] [is_string=false]'
Notice: [value=5] [is_integer=true] [is_numberic=true] [is_string=false]
Notice: /Stage[main]/Jboss::Config::Datasources/Jboss::Config::Datasourceadd[ifw]/Notify[ifw: idle_timeout_minutes]/message: defined 'message' as '[value=5] [is_integer=true] [is_numberic=true] [is_string=false]'

As weird as this maybe, in either case the jboss_admin module i think should be handling these numeric oddities, and essentially if number just ignore whether or not it is quoted as a string or not.

itewk commented 9 years ago

@cpitman i have fought with this one for a while and can't figure it out. I am guessing there is some function in newparam that can be overriden that will help here. for now my workaround is to make sure all my intiger values are wrapped in quotes.

mpeter commented 8 years ago

I've been solving this by using the bool2str function from puppet-stdlib. This at least let's me pass puppet-lint, as well as use the correct types for the passed in parameters.

class profile::jboss::config (
  $track_statements = true
) {
  jboss_admin::resource::data_source { '/subsystem=datasources/data-source=xxx':
    track_statements => bool2str($track_statements),
  }
}
itewk commented 8 years ago

@mpeter good work around, though I think it relates more to https://github.com/rhtconsulting/puppet-jboss_admin/issues/44 then this one.