Bug 1439883 - Unexpected error while executing a custom button
Summary: Unexpected error while executing a custom button
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.9.0
Assignee: Greg McCullough
QA Contact: Yadnyawalk Tale
URL:
Whiteboard:
Depends On:
Blocks: 1441249 1441251
TreeView+ depends on / blocked
 
Reported: 2017-04-06 18:34 UTC by Saif Ali
Modified: 2020-05-14 15:54 UTC (History)
7 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1441249 1441251 (view as bug list)
Environment:
Last Closed: 2018-03-06 15:19:40 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
fixed_proof (2.15 MB, image/gif)
2018-02-23 13:27 UTC, Yadnyawalk Tale
no flags Details
5.7.1.3_issue (53.97 KB, image/png)
2018-02-23 13:30 UTC, Yadnyawalk Tale
no flags Details

Description Saif Ali 2017-04-06 18:34:54 UTC
Description of problem:
I have a custom button on a service. If the service contains only archived VMs, the button will not execute any automation code and will give the error, "undefined method `zone' for nil:NilClass". This occurs even if I set the button to run /system/request/InspectMe. If any of the VMs in the service are active, the button runs as expected.

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

How reproducible:
Suggested steps to reproduce:
  -Create a button at the service level.
    -This button should be configured to call InspectMe
      -System/Process: Request
      -Message: create
      -Request: InspectMe
  -Create a service that contains 1 VM
  -Remove this VM from the provider, resulting in a VM state of 'Archived'
  -Go to the service and try to execute the button
  -At this point the UI should give you an error message, "undefined method `zone' for nil:NilClass." This message can be found in the evm log.
  -If you create another service that contains 2 VMs and only remove 1 of the VMs from the provider, the button will work on that service.

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Greg McCullough 2017-04-06 20:20:31 UTC
Is there a evm.log showing error stack trace you can provide?

Comment 4 Greg McCullough 2017-04-06 22:24:18 UTC
Tracked down the error to my_zone in the service model here:

https://github.com/ManageIQ/manageiq/blob/9466b4d3a5e7e6a4d816ac232cfd23527273893e/app/models/service.rb#L279

Comment 6 CFME Bot 2017-04-10 15:31:38 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/46b7f9f5f49f5401073a7944732cec2b97adaa15

commit 46b7f9f5f49f5401073a7944732cec2b97adaa15
Author:     Greg McCullough <gmccullo>
AuthorDate: Fri Apr 7 10:58:23 2017 -0400
Commit:     Greg McCullough <gmccullo>
CommitDate: Mon Apr 10 10:15:24 2017 -0400

    Service#my_zone should only reference a VM associated to a provider.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1439883

 app/models/service.rb       |  4 ++--
 spec/models/service_spec.rb | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)

Comment 9 Yadnyawalk Tale 2018-02-23 13:27:35 UTC
Created attachment 1399879 [details]
fixed_proof

Fixed! To conform what was the issue I tried to reproduced it on 5.7.1.3 and there was a bug indeed (image attached). Tried with same steps on 5.9.0.21 and not found any such issue (GIF attached).

Verified on:  5.9.0.21.20180214154720_6f2109d 
Thanks!

Comment 10 Yadnyawalk Tale 2018-02-23 13:30:37 UTC
Created attachment 1399880 [details]
5.7.1.3_issue


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