theforeman / puppetdb_foreman

PuppetDB proxy in Foreman
http://theforeman.org
GNU General Public License v3.0
32 stars 23 forks source link

3.1.2 fails to start - wrong number of arguments (6 for 3..5) (ArgumentError) #49

Closed traylenator closed 6 years ago

traylenator commented 6 years ago

With tfm-rubygem-puppetdb_foreman-3.0.2-1 foreman starts okay but there is however no options in the settings to set api_version of PDB.

With tfm-rubygem-puppetdb_foreman-3.1.2-1 foreman fails to start and reports.

wrong number of arguments (6 for 3..5) (ArgumentError)
  /usr/share/foreman/app/models/setting.rb:272:in `set'
  /opt/theforeman/tfm/root/usr/share/gems/gems/puppetdb_foreman-3.1.2/app/models/setting/puppetdb.rb:34:in `default_settings'
  /opt/theforeman/tfm/root/usr/share/gems/gems/puppetdb_foreman-3.1.2/app/models/setting/puppetdb.rb:43:in `block in load_defaults'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:208:in `transaction'
  /opt/theforeman/tfm/root/usr/share/gems/gems/puppetdb_foreman-3.1.2/app/models/setting/puppetdb.rb:42:in `load_defaults'
  /usr/share/foreman/config/initializers/foreman.rb:21:in `each'
  /usr/share/foreman/config/initializers/foreman.rb:21:in `<top (required)>'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `block in load'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/engine.rb:648:in `block in load_config_initializer'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/notifications.rb:161:in `instrument'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/engine.rb:647:in `load_config_initializer'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/engine.rb:611:in `each'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/engine.rb:611:in `block in <class:Engine>'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:30:in `instance_exec'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:30:in `run'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:55:in `block in run_initializers'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:226:in `block in tsort_each'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:429:in `each_strongly_connected_component_from'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:419:in `block in each_strongly_connected_component_from'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:44:in `each'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:44:in `tsort_each_child'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:413:in `call'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:413:in `each_strongly_connected_component_from'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:347:in `block in each_strongly_connected_component'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `each'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `call'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `each_strongly_connected_component'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:224:in `tsort_each'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:203:in `tsort_each'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:54:in `run_initializers'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application.rb:300:in `initialize!'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/railtie.rb:194:in `public_send'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/railtie.rb:194:in `method_missing'
  /usr/share/foreman/config/environment.rb:5:in `<top (required)>'
  /opt/rh/rh-ruby22/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in `require'
  /opt/rh/rh-ruby22/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in `require'
  config.ru:3:in `block in <main>'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /usr/share/gems/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:in `eval'
  /usr/share/gems/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:in `preload_app'
  /usr/share/gems/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:150:in `<module:App>'
  /usr/share/gems/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /usr/share/gems/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:28:in `<main>'
traylenator commented 6 years ago

Plugin needs backporting,

diff puppetdb.rb.ORIG puppetdb.rb
34c34
<       set('puppetdb_api_version', _('Foreman will use this PuppetDB API version'), default_api_version, N_('PuppetDB API Version'), nil, collection: proc { ::Puppetdb::API_VERSIONS })
---
>       set('puppetdb_api_version', _('Foreman will use this PuppetDB API version'), default_api_version)

seems to do the trick.