Bug #7999
closedForeman discovery importing facts: wrong number of arguments (2 for 1)
Description
Fresh installation of Foreman 1.6.1 with discovery 1.4-rc4 and image 0.6 (installed using the foreman installer with --enable-foreman-plugin-discovery). There have been more reports of people having this problem: https://groups.google.com/forum/#!topic/foreman-users/bdCeXosWDXw
Full foreman production.log trace:
Started POST "/api/v2/discovered_hosts/facts" for 10.10.10.2 at 2014-10-17 12:38:43 +0200 Processing by Api::V2::DiscoveredHostsController#facts as JSON Parameters: {"facts"=>"[FILTERED]", "apiv"=>"v2", "discovered_host"=>{"facts"=>"[FILTERED]"}} Import facts for 'mac080027bf98b0' completed. Added: 0, Updated: 0, Deleted 0 facts wrong number of arguments (2 for 1) (ArgumentError) /usr/share/foreman/app/models/host/base.rb:69:in `populate_fields_from_facts' /usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_discovery-1.4.0.rc4/app/models/host/discovered.rb:81:in `populate_fields_from_facts' /usr/share/foreman/app/models/host/base.rb:54:in `import_facts' /usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_discovery-1.4.0.rc4/app/models/host/discovered.rb:71:in `import_facts' /usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_discovery-1.4.0.rc4/app/models/host/discovered.rb:63:in `import_host_and_facts' /usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_discovery-1.4.0.rc4/app/controllers/api/v2/discovered_hosts_controller.rb:96:in `facts' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/implicit_render.rb:4:in `send_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/base.rb:167:in `process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/rendering.rb:10:in `process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/callbacks.rb:18:in `block in process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:495:in `block (4 levels) in _run__4488231903361965646__process_action__2226559520370275985__callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_7093' /usr/share/foreman/app/controllers/api/v2/base_controller.rb:93:in `disable_json_root' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_7093' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:494:in `block (3 levels) in _run__4488231903361965646__process_action__2226559520370275985__callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_7092' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:326:in `around' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:310:in `_callback_around_2370' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_7092' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:482:in `block (2 levels) in _run__4488231903361965646__process_action__2226559520370275985__callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_7091' /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:33:in `clear_thread' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_7091' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:426:in `block in _run__4488231903361965646__process_action__2226559520370275985__callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_7090' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:326:in `around' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:310:in `_callback_around_13' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_7090' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:414:in `_run__4488231903361965646__process_action__2226559520370275985__callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `__run_callback' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:81:in `run_callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/callbacks.rb:17:in `process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/rescue.rb:29:in `process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/notifications.rb:123:in `block in instrument' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/notifications.rb:123:in `instrument' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/instrumentation.rb:29:in `process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/params_wrapper.rb:207:in `process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/railties/controller_runtime.rb:18:in `process_action' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/base.rb:121:in `process' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/rendering.rb:45:in `process' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal.rb:203:in `dispatch' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal.rb:246:in `block in action' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/route_set.rb:73:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/route_set.rb:73:in `dispatch' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/route_set.rb:36:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/mapper.rb:43:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call' /usr/share/foreman/vendor/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each' /usr/share/foreman/vendor/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/route_set.rb:608:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/apipie-rails-0.2.6/lib/apipie/extractor/recorder.rb:97:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/apipie-rails-0.2.6/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:35:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/head.rb:14:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/params_parser.rb:21:in `call' /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:9:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/flash.rb:242:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/cookies.rb:341:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/query_cache.rb:64:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `_run__379184286496844165__call__370853736905932193__callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `__run_callback' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:385:in `_run_call_callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:81:in `run_callbacks' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/callbacks.rb:27:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/remote_ip.rb:31:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.18/lib/rails/rack/logger.rb:32:in `call_app' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.18/lib/rails/rack/logger.rb:16:in `block in call' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/tagged_logging.rb:22:in `tagged' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.18/lib/rails/rack/logger.rb:16:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/request_id.rb:22:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/cache/strategy/local_cache.rb:72:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/static.rb:63:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in `pass' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in `invalidate' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:in `call!' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.18/lib/rails/engine.rb:484:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.18/lib/rails/application.rb:231:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.18/lib/rails/railtie/configurable.rb:30:in `method_missing' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each' /usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call' /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:142:in `accept_and_process_next_request' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:448:in `block (3 levels) in start_threads' Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (0.9ms) Completed 500 Internal Server Error in 40.9ms (Views: 2.2ms | ActiveRecord: 8.3ms) Started POST "/discovers" for 10.10.10.2 at 2014-10-17 12:38:43 +0200 ActionController::RoutingError (No route matches [POST] "/discovers"): /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:142:in `accept_and_process_next_request' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:448:in `block (3 levels) in start_threads'
Files
Updated by Lukas Zapletal over 10 years ago
Hey Tom,
can you please attach your facts? Just copy&paste from the Discovered Host detail page. Thanks.
Updated by Tom Verdaat over 10 years ago
- File discovery tcpdump discovery tcpdump added
No I can't. The problem is that this happens when the discovery host is trying to register with Foreman. The host isn't actually showing up as a Discovered Host!
I've attached a tcpdump in stead. Hope that helps!
Updated by Dominic Cleal over 10 years ago
Looks like perhaps some of the 1.6/1.7 compat stuff is going wrong.
https://github.com/theforeman/foreman_discovery/blob/develop/app/models/host/discovered.rb#L79-L81
If you're using 1.6.1, then 1.6.1 > 1.6, so it follows the 1.7 code path. A more correct comparison would be ">= 1.7".
(On a side note, my stance remains that plugins should follow semver and branch for incompatible changes, not try to handle both.)
Updated by Frank Wall over 10 years ago
I've patched my 1.6.1 foreman according to Dominic's suggestion. Discovery is working again for me. I've submitted a pull request: https://github.com/theforeman/foreman_discovery/pull/92
Updated by Frank Wall over 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset d5c65b2ea636885f7acce05e3894151bb5f97047.