Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Remove Selected Items from Inventory button for Images, Instances #17780

Merged
merged 1 commit into from
Aug 1, 2018

Conversation

hstastna
Copy link

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


There is a problem with 'Remove selected items from Inventory' button in all the pages under Compute > Clouds while trying to remove Instance or Image. It's because validate_destroy method is called every time we try to delete some item but this method is available only for Host, at least for now.

Steps to reproduce: (one of possible scenarios)

  1. Go to Compute > Clouds > Providers and add some provider if there is no one
  2. In provider's details screen, in Relationships table, click on Images/Instances
  3. Choose some Images/Instances (check the checkboxes)
  4. Click on Configuration > Remove selected items from Inventory
    => the selected Images/Instances are not removed, error:
I, [2018-07-19T11:06:07.102659 #9372]  INFO -- : Started POST "/ems_cloud/button/38?pressed=image_delete" for ::1 at 2018-07-19 11:06:07 +0200
I, [2018-07-19T11:06:07.152445 #9372]  INFO -- : Processing by EmsCloudController#button as JS
I, [2018-07-19T11:06:07.153491 #9372]  INFO -- :   Parameters: {"miq_grid_checks"=>"2099", "check_2099"=>"2099", "pressed"=>"image_delete", "id"=>"38"}
F, [2018-07-19T11:06:07.382083 #9372] FATAL -- : Error caught: [NoMethodError] undefined method `validate_destroy' for #<ManageIQ::Providers::Amazon::CloudManager::Template:0x007f803d597d28>
Did you mean?  validate_stop
/home/hstastna/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activemodel-5.0.7/lib/active_model/attribute_methods.rb:433:in `method_missing'
/home/hstastna/manageiq/manageiq/app/models/mixins/availability_mixin.rb:24:in `is_available?'

Before:
image_before

After:
image_after

@hstastna
Copy link
Author

@miq-bot add_label bug, blocker, gaprindashvili/yes

@hstastna hstastna force-pushed the Error_delete_cloud_image_instance branch from 30b2549 to 7de8cf2 Compare July 31, 2018 16:16
@hstastna hstastna changed the title [WIP] Fix Remove Selected Items from Inventory button for Images, Instances Fix Remove Selected Items from Inventory button for Images, Instances Jul 31, 2018
@miq-bot miq-bot removed the wip label Jul 31, 2018
@miq-bot
Copy link
Member

miq-bot commented Jul 31, 2018

Checked commit hstastna@7de8cf2 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. ⭐

@hstastna
Copy link
Author

@Ladas What do you think about that? Thank you ;)

Copy link
Contributor

@Ladas Ladas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@Ladas
Copy link
Contributor

Ladas commented Aug 1, 2018

@agrare the story here is the the "Remove from VMDB" button never had any check, but UI guys are consolidating the buttons code, so now every action needs to have .supports?

@Ladas
Copy link
Contributor

Ladas commented Aug 1, 2018

@miq-bot assign @agrare

@agrare
Copy link
Member

agrare commented Aug 1, 2018

👍 good find, I wonder how many other buttons are like this though 😱

@agrare agrare merged commit 7de8cf2 into ManageIQ:master Aug 1, 2018
agrare added a commit that referenced this pull request Aug 1, 2018
…ance

Fix Remove Selected Items from Inventory button for Images, Instances
@agrare agrare added this to the Sprint 92 Ending Aug 13, 2018 milestone Aug 1, 2018
@simaishi
Copy link
Contributor

simaishi commented Oct 3, 2018

As per BZ Target Release, removing gaprindashvili/yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants