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

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

Open
itewk opened this issue Oct 29, 2014 · 5 comments
Labels

Comments

@itewk
Copy link
Contributor

itewk commented Oct 29, 2014

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 itewk added the bug label Oct 29, 2014
@itewk
Copy link
Contributor Author

itewk commented Oct 29, 2014

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
Copy link
Contributor Author

itewk commented Oct 29, 2014

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
Copy link
Contributor Author

itewk commented Oct 29, 2014

@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.

@itewk itewk changed the title Every time I run puppet it thinks my idle-timeout-minutes is changing sometimes numbers need to be quoted and sometimes they do not, causes puppet to always run Nov 24, 2014
@mpeter
Copy link

mpeter commented Feb 11, 2016

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
Copy link
Contributor Author

itewk commented Feb 11, 2016

@mpeter good work around, though I think it relates more to #44 then this one.

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

No branches or pull requests

2 participants