Bug 1439883

Summary: Unexpected error while executing a custom button
Product: Red Hat CloudForms Management Engine Reporter: Saif Ali <saali>
Component: AutomateAssignee: Greg McCullough <gmccullo>
Status: CLOSED CURRENTRELEASE QA Contact: Yadnyawalk Tale <ytale>
Severity: high Docs Contact:
Priority: high    
Version: 5.7.0CC: cpelland, jhardy, mkanoor, obarenbo, saali, simaishi, tfitzger
Target Milestone: GAKeywords: TestOnly
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1441249 1441251 (view as bug list) Environment:
Last Closed: 2018-03-06 15:19:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1441249, 1441251    
Attachments:
Description Flags
fixed_proof
none
5.7.1.3_issue none

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