Bug 1379854

Summary: Cannot add or copy alerts
Product: Red Hat CloudForms Management Engine Reporter: Jeff Watts <jwatts>
Component: ControlAssignee: Lucy Fu <lufu>
Status: CLOSED CURRENTRELEASE QA Contact: Dmitry Misharov <dmisharo>
Severity: high Docs Contact:
Priority: high    
Version: 5.6.0CC: bascar, cpelland, dajohnso, dclarizi, jhardy, jwatts, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly
Target Release: 5.8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: control:alert
Fixed In Version: 5.8.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1386784 1389790 (view as bug list) Environment:
Last Closed: 2017-06-12 16:29:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1386784, 1389790    
Attachments:
Description Flags
Appliance Logs none

Description Jeff Watts 2016-09-27 21:11:47 UTC
Created attachment 1205330 [details]
Appliance Logs

Description of problem:

Cannot add a custom alert or copy an existing one.

Version-Release number of selected component (if applicable):

5.6.1.2.20160810181333_8ba817b


How reproducible:
The issue is very reproducible on the affected appliance. From what I understand, this does not affect all appliances. A re-install can fix the issue.

Steps to Reproduce:
1.Click Control => Explorer, then select the Alerts accordion
2.Click Configuration button => Add a New Alert
3.

Actual results:
The page refreshes and then nothing

Expected results:
Expecting to see the Adding a new alert creation page

Additional info:

Comment 3 Harpreet Kataria 2016-09-28 14:05:09 UTC
Lucy,

UI seems to be throwing an error if user has vm_vdi_login_session event in their db, can you please take a look to see how this event got in the user's db

[----] F, [2016-09-28T09:35:59.408288 #4607:4b5caa8] FATAL -- : Error caught: [RuntimeError] unexpected error, no type found for event vm_vdi_login_session
/home/hkataria/dev/manageiq/app/models/miq_event_definition.rb:67:in `etype'
/home/hkataria/dev/manageiq/app/controllers/miq_policy_controller/alerts.rb:283:in `block in alert_build_edit_screen'
/home/hkataria/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/delegation.rb:38:in `each'
/home/hkataria/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/delegation.rb:38:in `each'
/home/hkataria/dev/manageiq/app/controllers/miq_policy_controller/alerts.rb:280:in `alert_build_edit_screen'
/home/hkataria/dev/manageiq/app/controllers/miq_policy_controller/alerts.rb:41:in `alert_edit'
/home/hkataria/dev/manageiq/app/controllers/miq_policy_controller.rb:132:in `x_button'


Let me know if you have questions or anything in UI code needs to be adjusted.

Thanks,
~Harpreet

Comment 4 Lucy Fu 2016-09-28 14:26:51 UTC
What kind of environment is this? Is it migrated from an old version?

vm_vdi_login_session event has been removed since version 5.4 but it was in this DB and caused the issue.

Removing vm_vdi_login_session event from DB would fix the issue.

Comment 15 CFME Bot 2016-10-18 15:36:18 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/2e1953182187be58268b7ab88d18a66692a886fa

commit 2e1953182187be58268b7ab88d18a66692a886fa
Author:     Lucy Fu <lufu>
AuthorDate: Wed Oct 5 13:31:16 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Thu Oct 13 12:10:12 2016 -0400

    Fix the issue that user can't add alerts.
    
    When seeded from the fixture file, default events in miq_event_definitions table always belong to certain event set.
    However there are some appliances from 5.6 fresh installation that have some deleted old events showed up in the DB and not belong to any event set.
    UI for Add a New Alert would not open due to these ghost and orphaned events.
    
    So far we can't find out why these deleted events still showed up in a fresh appliance. It is strange.
    This commit would skip these orphaned events so users can access the Add a New Alert page.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1379854

 app/controllers/miq_policy_controller/alerts.rb |  3 +-
 app/models/miq_event_definition.rb              |  8 +++--
 spec/models/miq_event_definition_spec.rb        | 44 +++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 5 deletions(-)

Comment 16 CFME Bot 2016-10-19 03:57:18 UTC
New commit detected on ManageIQ/manageiq/euwe:
https://github.com/ManageIQ/manageiq/commit/d88e9221901f0079a60ecf11fd00a37b875fa4dc

commit d88e9221901f0079a60ecf11fd00a37b875fa4dc
Author:     Greg McCullough <gmccullo>
AuthorDate: Tue Oct 18 17:32:44 2016 +0200
Commit:     Oleg Barenboim <chessbyte>
CommitDate: Tue Oct 18 22:54:15 2016 -0500

    Merge pull request #11718 from lfu/event_no_set_type_1379854
    
    Fix the issue that user can't add alerts.
    (cherry picked from commit 8b43521a41cf3a6fe9832badf9a2e78b4cbb8430)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1379854

 app/controllers/miq_policy_controller/alerts.rb |  3 +-
 app/models/miq_event_definition.rb              |  8 +++--
 spec/models/miq_event_definition_spec.rb        | 44 +++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 5 deletions(-)

Comment 21 Dmitry Misharov 2017-02-27 15:56:50 UTC
Verified in 5.8.0.2.20170223184827_489bf7c. Alerts can be created and copied.