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

Rescue failed container annotation attempts #13075

Closed
wants to merge 1 commit into from

Conversation

enoodle
Copy link

@enoodle enoodle commented Dec 9, 2016

When failing to annotate a container entity an error is thrown, this caught and will then cause ui_lookup to be called with the module instead of its name which will cause another uncaught error in the controller that will be thrown.

Updated all the calls in the file of to ui_lookup to send the model's name instead of the model. Also refactored this specific error message.

PS: The flash is not displayed correctly on error but this is out of scope for this patch.

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

cc @moolitayer @simon3z @yaacov @nimrodshn PTAL

@yaacov
Copy link
Member

yaacov commented Dec 9, 2016

LGTM 👍

@nimrodshn
Copy link
Contributor

LGTM 👍

@@ -188,7 +188,7 @@ def check_compliance(model)

def find_current_item(model)
if params[:id].nil? || model.find_by(:id => params[:id].to_i).nil?
add_flash(_("%{model} no longer exists") % {:table => ui_lookup(:model => model)}, :error)
add_flash(_("%{model} no longer exists") % {:table => ui_lookup(:model => model.to_s)}, :error)
Copy link

Choose a reason for hiding this comment

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

This seems strange. The format hash should contain variables that appear in the formatted string. table isn't found there.

Copy link
Author

Choose a reason for hiding this comment

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

I agree, I blindly fixed the similar problem in different places.

Copy link
Author

Choose a reason for hiding this comment

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

@moolitayer I changed this

Choose a reason for hiding this comment

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

@cben please review this change, original code came in 8b81dbc

@enoodle
Copy link
Author

enoodle commented Dec 11, 2016

@cben PTAL

@cben
Copy link
Contributor

cben commented Dec 11, 2016

LGTM, thanks!
My bad, apparently when I wrote this code I never tested the error handling.
Good catch, that split error was not obvious...

@moolitayer
Copy link

We are going to need a test for this fix.
Minimal: add it in container_image_controller_spec.rb.
Better: create containers_common_mixin_spec.rb

@miq-bot
Copy link
Member

miq-bot commented Dec 11, 2016

Checked commit enoodle@9d76e5f with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
2 files checked, 0 offenses detected
Everything looks good. 🍰

@enoodle
Copy link
Author

enoodle commented Dec 11, 2016

@moolitayer I added a test to container_image_controller_spec.rb as creating a test just for the mixin proved difficult as it uses many application_controller methods.

@moolitayer
Copy link

@enoodle thanks! LGTM 👍

@enoodle
Copy link
Author

enoodle commented Dec 12, 2016

ping @simon3z

@miq-bot
Copy link
Member

miq-bot commented Dec 12, 2016

@enoodle Cannot apply the following label because they are not recognized: bug euwe/yes

@enoodle
Copy link
Author

enoodle commented Dec 12, 2016

@miq-bot add_label bug, euwe/yes

@enoodle
Copy link
Author

enoodle commented Dec 15, 2016

@simon3z what about merging it to master?

@simon3z
Copy link
Contributor

simon3z commented Dec 15, 2016

👍 ready cc @chessbyte

@miq-bot assign chessbyte

@miq-bot miq-bot assigned chessbyte and unassigned simon3z Dec 20, 2016
@miq-bot
Copy link
Member

miq-bot commented Dec 22, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@enoodle
Copy link
Author

enoodle commented Jan 2, 2017

closed for its ui-classic counter-part. if needed a backport to euwe will be created after the ui-classic is merged.

@simon3z
Copy link
Contributor

simon3z commented Jan 24, 2017

IIUC this was moved to ManageIQ/manageiq-ui-classic#34

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.

None yet

8 participants