Bug 1628224 - Custom Button: Submit_all on All page for multiple entity select gives Error.
Summary: Custom Button: Submit_all on All page for multiple entity select gives Error.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.10.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.10.0
Assignee: drew uhlmann
QA Contact: Nikhil Dhandre
URL:
Whiteboard: custom_button
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-12 13:35 UTC by Nikhil Dhandre
Modified: 2019-02-12 16:50 UTC (History)
11 users (show)

Fixed In Version: 5.10.0.22
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-02-12 16:50:07 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Steps and BZ refection. (3.02 MB, image/gif)
2018-09-12 13:35 UTC, Nikhil Dhandre
no flags Details

Description Nikhil Dhandre 2018-09-12 13:35:37 UTC
Created attachment 1482686 [details]
Steps and BZ refection.

Description of problem:
-----------------------
With `submit all` and display for `single and list` getting the error while executing for multiple entities objects. I tested it with two objects VM and Host. It may be refect on all other custom button objects as sharing the same bunch of code. 


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


How reproducible:
----------------
Always


Steps to Reproduce:
-------------------
1. Create a custom button group on with HOST/VM object 
2. Create a custom button with the following configuration
Dialog: None
Open URL: false
Display for: Single and list
Submit: Submit all
System/Process/: Request
Request: InspectMe

3. Now navigate to object `All` Page
4. Try to execute custom button with a single object. It will work
5. Now, try to select `multiple/all` objects on `All` page.

Actual results:
--------------------
Error executing: "submit_all button" undefined method `primary_key' for Vm::ActiveRecord_Relation:Class

Expected results:
-----------------------
It should execute and send a single request for all selected objects. 

Additional info:
----------------------
Attaching gif file

Comment 4 William Fitzgerald 2018-09-14 17:56:53 UTC
I was able to reproduce this with a Host button.

Works on a single item but if you select multiple items, the error occurs.

Reproducer : 10.8.198.217

Billy

Comment 6 drew uhlmann 2018-10-01 17:38:15 UTC
https://github.com/ManageIQ/manageiq/pull/18042

Comment 7 CFME Bot 2018-10-02 13:21:16 UTC
New commit detected on ManageIQ/manageiq/hammer:

https://github.com/ManageIQ/manageiq/commit/9a9f529a3be9c31132cc9d57a809faeb7e23661f
commit 9a9f529a3be9c31132cc9d57a809faeb7e23661f
Author:     Brandon Dunne <brandondunne>
AuthorDate: Mon Oct  1 14:35:47 2018 -0400
Commit:     Brandon Dunne <brandondunne>
CommitDate: Mon Oct  1 14:35:47 2018 -0400

    Merge pull request #18042 from d-m-u/custom_button_event_fix_for_bz1628224

    Create custom button events for each object in target list

    (cherry picked from commit 4b78ead7c15a39ac01fb17b9678cd64b7378007a)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1628224

 app/models/custom_button.rb | 6 +-
 spec/models/custom_button_spec.rb | 30 +-
 2 files changed, 29 insertions(+), 7 deletions(-)

Comment 10 drew uhlmann 2018-10-04 12:23:45 UTC
https://github.com/ManageIQ/manageiq/pull/18056

Comment 11 drew uhlmann 2018-10-05 15:03:41 UTC
Ok, sorry Nikhil, take two!

Comment 12 CFME Bot 2018-10-05 16:01:23 UTC
New commit detected on ManageIQ/manageiq/hammer:

https://github.com/ManageIQ/manageiq/commit/1310fd6601221b8940e73edfdc7dbbaeba8d6271
commit 1310fd6601221b8940e73edfdc7dbbaeba8d6271
Author:     Greg McCullough <gmccullo>
AuthorDate: Fri Oct  5 10:51:47 2018 -0400
Commit:     Greg McCullough <gmccullo>
CommitDate: Fri Oct  5 10:51:47 2018 -0400

    Merge pull request #18056 from d-m-u/use_whoops_size_rather_than_possibly_nonexistent_array

    Force targets to be an array so we can each them in cb run on multiple objects

    (cherry picked from commit ead55ecf0c3b576028caaa3103b7b2b190508c7c)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1628224

 app/models/custom_button.rb | 2 +-
 spec/models/custom_button_spec.rb | 49 +-
 2 files changed, 36 insertions(+), 15 deletions(-)

Comment 13 Nikhil Dhandre 2018-10-11 08:48:13 UTC
I tested it with Version 5.10.0.19

UI error fixed nearly for all custom button type objects but...

with button conf:
Submit: Submit all


Suppose I have 20 entities and when I select all of those and execute custom button flash message awesome but I am not getting a request in automation log. It should fire a single request for 20 entities. 

test_infra_objects.py::test_custom_button_automate[Datastore-virtualcenter-Submit_all] FAILED
test_infra_objects.py::test_custom_button_automate[Template_image-virtualcenter-Submit_all] FAILED


with button conf:
Submit: One by One

automation log showing me 20 request after execution.
test_infra_objects.py::test_custom_button_automate[Template_image-virtualcenter-One_by_one] PASSED

Comment 16 drew uhlmann 2018-10-11 14:09:30 UTC
Okay, peeps, please ignore comment 15, and in lieu of it, here's this: https://github.com/ManageIQ/manageiq/pull/18088 cause I like that solution better. Thanks!

Comment 17 drew uhlmann 2018-10-24 15:31:47 UTC
Okay, peeps, the PR listed in comment 16 isn't the right one, either.

Comment 19 CFME Bot 2018-10-25 17:42:26 UTC
New commit detected on ManageIQ/manageiq-automation_engine/hammer:

https://github.com/ManageIQ/manageiq-automation_engine/commit/58ec9220bc415118cf5ec3c214e6db7f6e72de27
commit 58ec9220bc415118cf5ec3c214e6db7f6e72de27
Author:     Greg McCullough <gmccullo>
AuthorDate: Thu Oct 25 09:35:51 2018 -0400
Commit:     Greg McCullough <gmccullo>
CommitDate: Thu Oct 25 09:35:51 2018 -0400

    Merge pull request #258 from d-m-u/integer_or_Integer_in_object_convert_value_based_on_datatype

    convert_value_based_on_datatype won't take "Integer"

    (cherry picked from commit 67488e44a7d3529400f55f34d1a9a8452e8ee0b0)

    https://bugzilla.redhat.com/show_bug.cgi?id=1628224

 lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_object.rb | 2 +-
 spec/miq_ae_object_spec.rb | 6 +
 2 files changed, 7 insertions(+), 1 deletion(-)

Comment 20 Nikhil Dhandre 2018-11-01 10:41:40 UTC
tested with 5.10.0.22 working fine


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