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

Fix event_catcher blacklisted events logging #15945

Merged
merged 1 commit into from
Sep 7, 2017

Conversation

agrare
Copy link
Member

@agrare agrare commented Sep 7, 2017

The event catcher runner was printing the blacklisted events array using
the VMDBLogger#log_hashes method. Now that this method calls .to_hash
on the argument
(ManageIQ/manageiq-gems-pending#268)
this is throwing an exception for non-hash type arguments.

Instead of using log_hashes just log the elements of the array joined by
newlines directly.

/home/agrare/workspace/redhat/manageiq/plugins/manageiq-gems-pending/lib/gems/pending/util/vmdb-logger.rb:116:in `log_hashes'[----] I, [2017-09-07T09:08:21.914128 #28447:2ab55ee0f0cc]: undefined method `to_hash' for #<Array:0x00556ac8a4ef88> (NoMethodError)
Did you mean?  to_h
	from /home/agrare/workspace/redhat/manageiq/plugins/manageiq-gems-pending/lib/gems/pending/util/vmdb-logger.rb:128:in `log_hashes'
	from /home/agrare/workspace/redhat/manageiq/lib/vmdb/loggers/multicast_logger.rb:34:in `block in method_missing'
	from /usr/lib/ruby/2.3.0/set.rb:306:in `each_key'
	from /usr/lib/ruby/2.3.0/set.rb:306:in `each'
	from /home/agrare/workspace/redhat/manageiq/lib/vmdb/loggers/multicast_logger.rb:34:in `map'
	from /home/agrare/workspace/redhat/manageiq/lib/vmdb/loggers/multicast_logger.rb:34:in `method_missing'
	from /home/agrare/workspace/redhat/manageiq/app/models/manageiq/providers/base_manager/event_catcher/runner.rb:22:in `after_initialize'

The event catcher runner was printing the blacklisted events array using
the VMDBLogger#log_hashes method.  Now that this method calls .to_hash
on the argument
(ManageIQ/manageiq-gems-pending#268)
this is throwing an exception for non-hash type arguments.

Instead of using log_hashes just log the elements of the array joined by
newlines directly.
@agrare agrare added the bug label Sep 7, 2017
@agrare agrare requested a review from Fryguy September 7, 2017 13:24
@agrare
Copy link
Member Author

agrare commented Sep 7, 2017

Lesson learned, if you call log_hashes on an array you're gonna have a bad time

@miq-bot
Copy link
Member

miq-bot commented Sep 7, 2017

Checked commit agrare@fb28b8f with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@Fryguy Fryguy merged commit 6636513 into ManageIQ:master Sep 7, 2017
@agrare agrare deleted the fix_event_catcher_log_hashes branch September 7, 2017 14:47
@Fryguy Fryguy added this to the Sprint 69 Ending Sep 18, 2017 milestone Sep 7, 2017
@Fryguy Fryguy added the core label Sep 7, 2017
@Fryguy Fryguy added the fine/yes label Jan 3, 2018
@Fryguy
Copy link
Member

Fryguy commented Jan 3, 2018

@simaishi
Copy link
Contributor

simaishi commented Jan 4, 2018

Fine backport details:

$ git log -1
commit e51d17241f9d00cdd04dc7963d191c015b1503df
Author: Jason Frey <[email protected]>
Date:   Thu Sep 7 10:46:40 2017 -0400

    Merge pull request #15945 from agrare/fix_event_catcher_log_hashes
    
    Fix event_catcher blacklisted events logging
    (cherry picked from commit 663651388b27e6eb3bc3ea10c1ad4185b2aacd7b)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1531146

simaishi pushed a commit that referenced this pull request Jan 4, 2018
d-m-u pushed a commit to d-m-u/manageiq that referenced this pull request Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants