Bug 1445009 - Traceback comparison of NilClass with String failed when selecting certain service dialogs
Summary: Traceback comparison of NilClass with String failed when selecting certain se...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Provisioning
Version: 5.7.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: GA
: cfme-future
Assignee: eclarizi
QA Contact: Shveta
URL:
Whiteboard: service:dialog:ui:error
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-24 17:48 UTC by Reartes Guillermo
Modified: 2018-10-02 14:32 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-02 14:30:03 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
screenshot, red ones -> problematic, orange -> the first one (62.55 KB, image/png)
2017-04-24 17:48 UTC, Reartes Guillermo
no flags Details
production.log showing the traceback (13.56 KB, text/plain)
2017-04-24 17:49 UTC, Reartes Guillermo
no flags Details
DC-MAIN support data (864.84 KB, application/zip)
2017-04-24 17:55 UTC, Reartes Guillermo
no flags Details
DC-RHV-Worker Support Data (343.67 KB, application/zip)
2017-04-24 17:56 UTC, Reartes Guillermo
no flags Details
This dialog is GOOD, no issues. (1.56 KB, text/x-vhdl)
2017-04-26 14:50 UTC, Reartes Guillermo
no flags Details
This dialog is DEFECTIVE, it causes the traceback. (1.57 KB, text/x-vhdl)
2017-04-26 14:51 UTC, Reartes Guillermo
no flags Details
_dialog_sample Hotfix file (8.00 KB, application/x-tar)
2017-04-26 15:15 UTC, eclarizi
no flags Details
Editing Dialog GOOD, the '<Choose>' entry is shown. (76.22 KB, image/png)
2017-04-26 15:26 UTC, Reartes Guillermo
no flags Details
Same dialog, after deleting the '<Choose>' entry. Please note that it caused an WebUI artifact (red) (77.87 KB, image/png)
2017-04-26 15:27 UTC, Reartes Guillermo
no flags Details

Description Reartes Guillermo 2017-04-24 17:48:46 UTC
Created attachment 1273678 [details]
screenshot, red ones -> problematic, orange -> the first one

Description of problem:

Hi,

I was creating the service dialog (the orange box in the screenshot), at some moment, the "unexpected" error popped up. (the error about multiple tabs, but i had only one).

After the fact i noticed that now there is an issue with the service dialogs.
 
When i click/select certain service dialogs, i now get in production.log an "comparison of NilClass with String failed" error and the
dialog is not shown in the webui. 

The previously selected dialog is shown instead, and the actions apply also to the previously selected items. So one cannot edit or delete the offending dialog.

In the uploaded screenshot, i get the error "comparison of NilClass with String failed" on the items inside the red box.

All issues started when i was creating the item in the orange box and got interrupted by the "unexpected error".

I am still able to view and edit all dialogs (included the problematic ones) if i go:

AUTOMATE -> CUSTOMIZATION -> In "All Dialogs", check one of the offending ones -> Click the "configuration" Button and select "Edit the selected dialog".
If i do that, i do not get the traceback.

I recently updated to  5.7.2.1 from 5.7.1.3, i never saw this before.

With the method above, i deleted the offending dialog (orange box from the screenshot)

But the issue still remains for the other items in the red box. With the previous versions there was no issue at all.

I don't know if this was caused by an abnormal dialog creation or if it is new from 5.7.2.1 and general.

I rebooted (and cleaned logs) for both cfme appliances.

The issue still persist. 


How reproducible:
always

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

Steps to Reproduce:
1. Go to Automate -> Customization -> Service Dialogs
2. From the "left" "all-dialogs" list, select the offending dialogs
3. traceback

Actual results:
unable to select some service dialogs by clicking on them from the "left" "all-dialogs" list.

WORKAROUND: AUTOMATE -> CUSTOMIZATION -> In "All Dialogs" from the "right" (the one that has checkboxes), check one of the offending ones -> Click the "configuration" Button and select "Edit the selected dialog".
If i do that, i do not get the traceback.


Expected results:
being able to select (and edit, delete, etc) all services dialogs by clicking on them from the "left" "all-dialogs" list. (and no traceback)

Comment 2 Reartes Guillermo 2017-04-24 17:49:30 UTC
Created attachment 1273679 [details]
production.log showing the traceback

Comment 3 Reartes Guillermo 2017-04-24 17:55:54 UTC
Created attachment 1273681 [details]
DC-MAIN support data

Comment 4 Reartes Guillermo 2017-04-24 17:56:22 UTC
Created attachment 1273682 [details]
DC-RHV-Worker Support Data

Comment 5 eclarizi 2017-04-25 15:59:03 UTC
This sounds extremely similar to what was happening in this BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1435758

The fix should be the same, as it's crashing in the same place. There's a hotfix attached to that BZ that you should be able to use.

If the hotfix does not resolve the issue, please re-open this ticket.

*** This bug has been marked as a duplicate of bug 1435758 ***

Comment 6 Reartes Guillermo 2017-04-26 14:50:03 UTC
Hi,

I tried the hot-fix in BZ #1435758, but nothing changed.

Revisiting the production.log file:

[----] F, [2017-04-26T11:34:55.697139 #2849:140e970] FATAL -- : Error caught: [ActionView::Template::Error] comparison of NilClass with String failed
/var/www/miq/vmdb/app/views/miq_ae_customization/_dialog_sample.html.haml:77:in `sort_by'
/var/www/miq/vmdb/app/views/miq_ae_customization/_dialog_sample.html.haml:77:in `block (4 levels) in _app_views_miq_ae_customization__dialog_sample_html_haml___2929487655071113707_172871580'
/var/www/miq/vmdb/app/views/miq_ae_customization/_dialog_sample.html.haml:19:in `each'
/var/www/miq/vmdb/app/views/miq_ae_customization/_dialog_sample.html.haml:19:in `block (3 levels) in _app_views_miq_ae_customization__dialog_sample_html_haml___2929487655071113707_172871580'
/var/www/miq/vmdb/app/views/miq_ae_customization/_dialog_sample.html.haml:13:in `each'
/var/www/miq/vmdb/app/views/miq_ae_customization/_dialog_sample.html.haml:13:in `block (2 levels) in _app_views_miq_ae_customization__dialog_sample_html_haml___2929487655071113707_172871580'
/var/www/miq/vmdb/app/helpers/application_helper.rb:1361:in `block in miq_tab_content'

This leads to this code in the file '/var/www/miq/vmdb/app/views/miq_ae_customization/_dialog_sample.html.haml'

  - else
   - val = field.values.sort_by { |d| field.sort_by == :value ? d.first : d.last }

Hum, it is so suspicious...

I performed several import/export test and i created a minimal working dialog and a failing working dialog.

In the failing/defective dialog:

- name: number_of_sockets
  description: ''
  data_type: string

When 'data_type' is set to 'string' is when the issue does happen.
Editing the dialog and set 'data_type' to 'integer' fixes the issue.
 
I tested this on:

Server #1     : cfdlgtst1.example.com
CFME Version  : 5.7.0.17

Server #2     : cfme1.example.com
CFME Version  : 5.7.2.1

Comment 7 Reartes Guillermo 2017-04-26 14:50:32 UTC
Created attachment 1274261 [details]
This dialog is GOOD, no issues.

Comment 8 Reartes Guillermo 2017-04-26 14:51:06 UTC
Created attachment 1274263 [details]
This dialog is DEFECTIVE, it causes the traceback.

Comment 9 Reartes Guillermo 2017-04-26 14:53:56 UTC
Does CFME perform some form of validation for the dialogs and also when importing any dialog?

Cheers.

Comment 10 eclarizi 2017-04-26 15:14:37 UTC
Hmm, it's possible the hotfix is incorrect, but the line that it is blowing up on should not exist in the fixed code.

I'll attached the _dialog_sample.html.haml as it should be in the latest 5.7 release. Please update the file on all of the UI appliances and restart them and see if that helps.

Comment 11 eclarizi 2017-04-26 15:15:40 UTC
Created attachment 1274269 [details]
_dialog_sample Hotfix file

Comment 12 Reartes Guillermo 2017-04-26 15:21:18 UTC
Hi,

Also there is this in both dialogs GOOD/DEFECTIVE: 

        values:
        - - 
          - "<Choose>"
        - - '1'
          - Single Socket
        - - '2'
          - Dual Socket
        - - '4'
          - Quad Socket


I had no idea where the '<Choose>' element came from.

Cheers.

Comment 13 Reartes Guillermo 2017-04-26 15:26:40 UTC
Created attachment 1274284 [details]
Editing Dialog GOOD, the '<Choose>' entry is shown.

Comment 14 Reartes Guillermo 2017-04-26 15:27:42 UTC
Created attachment 1274285 [details]
Same dialog, after deleting the '<Choose>' entry. Please note that it caused an WebUI artifact (red)

Comment 15 Reartes Guillermo 2017-04-26 16:11:45 UTC
Hi,

On CFME: 5.7.2.1 the _dialog_sample.html.haml was different from the one in the attachment in Comment #11

$ diff _dialog_sample.html.haml _dialog_sample.html.haml-BAD
72c72,80
<                             - val = copy_array(field.values)
---
>                             - if field.sort_by.to_s != "none"
>                               - if field.data_type == "integer"
>                                 - val = field.values.sort_by { |d| field.sort_by == :value ? d.first.to_i : d.last.to_i }
>                                 - val = val.reverse if field.sort_order == :descending
>                               - else
>                                 - val = field.values.sort_by { |d| field.sort_by == :value ? d.first : d.last }
>                                 - val = val.reverse if field.sort_order == :descending
>                             - else
>                               - val = copy_array(field.values)


I updated the _dialog_sample.html.haml in the appliance with the updated one and restarted the appliance.

After that, i went to sevice dialogs (and withoud doing anything more) clicked fast over each dialog, specially the ones
that caused the traceback.

All dialogs displayed correctly and there were no tracebacks in production.log.

The CFME appliance "cfme1.example.com" history was: 4.1.x -> Upgrade 4.2.x. (It was not a fresh 4.2.x deployment).

Thanks.

Comment 16 Josh Carter 2018-10-02 14:30:03 UTC
Dear customer, 

The CloudForms team is reviewing the current CloudForms Bug(defect) backlog in order to target engineering efforts. We are closing any bugs for versions that no longer have an active errata stream or that have hit their age limit. We are committing to better management of the backlog as we move forward. If you have an bug that you are still able to reproduce on a current version of CloudForms please open a new bug. 

If you have any concerns about this, please let us know.

Thanks and regards!

Comment 17 Josh Carter 2018-10-02 14:32:41 UTC
Dear customer, 

The CloudForms team is reviewing the current CloudForms Bug(defect) backlog in order to target engineering efforts. We are closing any bugs for versions that no longer have an active errata stream or that have hit their age limit. We are committing to better management of the backlog as we move forward. If you have an bug that you are still able to reproduce on a current version of CloudForms please open a new bug. 

If you have any concerns about this, please let us know.

Thanks and regards!


Note You need to log in before you can comment on or make changes to this bug.