Project

General

Profile

Bug #23965

audit: undefined method `each' for "":String

Added by Ohad Levy about 1 year ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Audit Log
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

2018-06-17T12:00:19 [I|app|] Started GET "/audits" for 1127.0.0.1 at 2018-06-17 12:00:19 +0100
2018-06-17T12:00:19 [I|app|3ff45] Processing by AuditsController#index as HTML
2018-06-17T12:00:19 [I|app|3ff45] Current user: admin (administrator)
2018-06-17T12:00:19 [I|app|3ff45]   Rendering audits/index.html.erb within layouts/application
2018-06-17T12:00:19 [I|app|3ff45] Deface: [WARNING] No :original defined for 'deleted_expired_host_audit_comment_in_list', you should change its definition to include:
 |  :original => 'e78203a5b4dde147f64d08cb6c9264e2c0ae6cc2' 
2018-06-17T12:00:19 [W|app|3ff45] Could not render audit_title
 | NoMethodError: undefined method `each' for "":String
 | /home/foreman/gems/gems/activerecord-5.1.6/lib/active_record/associations/collection_association.rb:241:in `replace'
 | /home/foreman/gems/gems/activerecord-5.1.6/lib/active_record/associations/collection_association.rb:39:in `writer'
 | /home/foreman/gems/gems/activerecord-5.1.6/lib/active_record/associations/builder/association.rb:119:in `organizations='
 | /home/foreman/gems/gems/audited-4.7.1/lib/audited/audit.rb:160:in `block in assign_revision_attributes'
 | /home/foreman/gems/gems/audited-4.7.1/lib/audited/audit.rb:154:in `each'
 | /home/foreman/gems/gems/audited-4.7.1/lib/audited/audit.rb:154:in `assign_revision_attributes'
 | /home/foreman/gems/gems/audited-4.7.1/lib/audited/audit.rb:68:in `block in revision'
 | /home/foreman/gems/gems/audited-4.7.1/lib/audited/audit.rb:67:in `tap'
 | /home/foreman/gems/gems/audited-4.7.1/lib/audited/audit.rb:67:in `revision'
 | /home/foreman/git/foreman/app/helpers/audits_helper.rb:41:in `audit_title'
 | /home/foreman/git/foreman/app/helpers/audits_helper.rb:196:in `audit_details'
 | /home/foreman/git/foreman/app/views/audits/_list.html.erb:14:in `block in _7d7e1b68ae1da1e787e7a3b502b19bb7'
 | /home/foreman/gems/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
 | /home/foreman/gems/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
 | /home/foreman/git/foreman/app/views/audits/_list.html.erb:1:in `_7d7e1b68ae1da1e787e7a3b502b19bb7'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/template.rb:157:in `block in render'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:168:in `instrument'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/template.rb:352:in `instrument_render_template'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/template.rb:155:in `render'
 | /home/foreman/gems/gems/deface-1.3.0/lib/deface/action_view_extensions.rb:41:in `render'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/partial_renderer.rb:342:in `block in render_partial'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `block in instrument'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `instrument'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/abstract_renderer.rb:41:in `instrument'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/partial_renderer.rb:331:in `render_partial'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/partial_renderer.rb:310:in `render'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/renderer.rb:47:in `render_partial'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/renderer.rb:21:in `render'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/helpers/rendering_helper.rb:32:in `render'
 | /home/foreman/git/foreman/app/views/audits/index.html.erb:4:in `_93394f3b4f1cf239fc2968cd9871bd08'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/template.rb:157:in `block in render'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:168:in `instrument'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/template.rb:352:in `instrument_render_template'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/template.rb:155:in `render'
 | /home/foreman/gems/gems/deface-1.3.0/lib/deface/action_view_extensions.rb:41:in `render'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/template_renderer.rb:52:in `block (2 levels) in render_template'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `block in instrument'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `instrument'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/abstract_renderer.rb:41:in `instrument'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/template_renderer.rb:51:in `block in render_template'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/template_renderer.rb:59:in `render_with_layout'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/template_renderer.rb:50:in `render_template'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/template_renderer.rb:14:in `render'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/renderer.rb:42:in `render_template'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/renderer/renderer.rb:23:in `render'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/rendering.rb:103:in `_render_template'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/streaming.rb:217:in `_render_template'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/rendering.rb:83:in `render_to_body'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/renderers.rb:141:in `render_to_body'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/abstract_controller/rendering.rb:24:in `render'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/rendering.rb:36:in `render'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
 | /opt/rh/rh-ruby24/root/usr/share/ruby/benchmark.rb:308:in `realtime'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/core_ext/benchmark.rb:12:in `ms'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
 | /home/foreman/gems/gems/activerecord-5.1.6/lib/active_record/railties/controller_runtime.rb:29:in `cleanup_view_runtime'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/instrumentation.rb:43:in `render'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/implicit_render.rb:33:in `default_render'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/basic_implicit_render.rb:4:in `tap'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:186:in `process_action'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/rendering.rb:30:in `process_action'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
 | /home/foreman/git/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/foreman/git/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/foreman/git/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/foreman/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/foreman/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/rescue.rb:20:in `process_action'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `block in instrument'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `instrument'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
 | /home/foreman/gems/gems/activerecord-5.1.6/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:124:in `process'
 | /home/foreman/gems/gems/actionview-5.1.6/lib/action_view/rendering.rb:30:in `process'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal.rb:189:in `dispatch'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_controller/metal.rb:253:in `dispatch'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:31:in `serve'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/journey/router.rb:33:in `each'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/journey/router.rb:33:in `serve'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:844:in `call'
 | /home/foreman/gems/gems/apipie-rails-0.5.8/lib/apipie/static_dispatcher.rb:65:in `call'
 | /home/foreman/gems/gems/apipie-rails-0.5.8/lib/apipie/extractor/recorder.rb:136:in `call'
 | /home/foreman/git/foreman/lib/middleware/telemetry.rb:9:in `call'
 | /home/foreman/gems/gems/apipie-rails-0.5.8/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /home/foreman/git/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/conditional_get.rb:25:in `call'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/head.rb:12:in `call'
 | /home/foreman/git/foreman/lib/middleware/logging_context.rb:23:in `call'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/cookies.rb:613:in `call'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:97:in `run_callbacks'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
 | /home/foreman/gems/gems/railties-5.1.6/lib/rails/rack/logger.rb:36:in `call_app'
 | /home/foreman/gems/gems/railties-5.1.6/lib/rails/rack/logger.rb:26:in `call'
 | /home/foreman/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/request_id.rb:25:in `call'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call'
 | /home/foreman/gems/gems/activesupport-5.1.6/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/executor.rb:12:in `call'
 | /home/foreman/gems/gems/actionpack-5.1.6/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
 | /home/foreman/gems/gems/secure_headers-5.0.5/lib/secure_headers/middleware.rb:13:in `call'
 | /home/foreman/gems/gems/railties-5.1.6/lib/rails/engine.rb:522:in `call'
 | /home/foreman/gems/gems/railties-5.1.6/lib/rails/railtie.rb:185:in `public_send'
 | /home/foreman/gems/gems/railties-5.1.6/lib/rails/railtie.rb:185:in `method_missing'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each'
 | /home/foreman/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call'
 | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/rack/thread_handler_extension.rb:89:in `process_request'
 | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
 | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
 | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/request_handler.rb:414:in `block (3 levels) in start_threads'
 | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/utils.rb:111:in `block in create_thread_and_abort_on_exception'
 | /home/foreman/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'


Related issues

Related to Foreman - Bug #22199: Audit user and user group linkingClosed2018-01-09
Related to Katello - Bug #24117: test failing for #23965 fixClosed2018-07-01
Related to Katello - Bug #24195: Audited associations are stored with _ids in audited changes Rejected2018-07-09
Related to Foreman - Bug #24572: Cannot revert template to its earlier stateClosed

Associated revisions

Revision 38f854cd (diff)
Added by Tomer Brisker 12 months ago

Fixes #23965 - Only save ids for association audits (#5753)

Otherwise, we have issues when trying to check revisions of the audit
since it will fail trying to assign a string to an attribute that
expects an object id.

History

#1 Updated by Tomer Brisker about 1 year ago

  • Related to Bug #22199: Audit user and user group linking added

#2 Updated by Tomer Brisker about 1 year ago

  • Legacy Backlogs Release (now unused) set to 330

This was introduced in https://github.com/theforeman/foreman/commit/d0eef9afa6d8e9ddd43fb1949ebadcd8245531aa which added changed to associations to the audits. The added associations are recorded as a string, while `Audit#revision` expects this to be an array so that it can assign the attributes to the revision. We should to store the IDs in the database and only turn them to strings in the view.

#3 Updated by Tomer Brisker 12 months ago

  • Triaged set to No
  • Assignee set to Tomer Brisker
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5753 added

#4 Updated by Tomer Brisker 12 months ago

  • Related to Bug #24117: test failing for #23965 fix added

#5 Updated by Marek Hulán 12 months ago

  • Related to Bug #24195: Audited associations are stored with _ids in audited changes added

#6 Updated by Marek Hulán 12 months ago

  • Fixed in Releases 1.18.0 added

#7 Updated by The Foreman Bot 12 months ago

  • Pull request https://github.com/theforeman/foreman/pull/5795 added

#8 Updated by Anonymous 12 months ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#9 Updated by Adam Ruzicka 11 months ago

  • Related to Bug #24572: Cannot revert template to its earlier state added

Also available in: Atom PDF