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

Fixes #20105 - index search not retained after deleting host #4969

Merged

Conversation

kgaikwad
Copy link
Member

@kgaikwad kgaikwad commented Nov 1, 2017

As hosts controller extension file is available in katello project, created PR-7047.

@theforeman-bot
Copy link
Member

Issues: #20105

Copy link
Member

@tbrisker tbrisker left a comment

Choose a reason for hiding this comment

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

This works when deleting a host from the hosts index page, but breaks when deleting a host from the host show page. Also note that a test is failing - which tests this behavior exactly.

@tbrisker
Copy link
Member

@kgaikwad a different test seems to be failing now, can you please take a look?

@kgaikwad
Copy link
Member Author

@tbrisker ,
Yes, I have checked test result.
I am looking into it but not able to get why it is failing with error - NoMethodError: undefined method encoding' for nil:NilClassin methodredirection_url_on_host_deletion`.

@tbrisker
Copy link
Member

[test foreman]

@kgaikwad
Copy link
Member Author

@tbrisker,
Got the reason.
On my local setup Katello feature is enabled that's why I was not able to reproduce test failure.
After disabling it, I am able to reproduce error - NoMethodError: undefined method encoding' for nil:NilClass`

encoding is used inside routes.recognize_path method.
Now I have handled nil value for session["redirect_to_url_#{controller_name}"], hopefully it will fix the test cases.

Copy link
Member

@ohadlevy ohadlevy left a comment

Choose a reason for hiding this comment

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

thanks for your patch two questions:

  1. why is this file in the host_details concern? I think it should be in the host controller?
  2. can you please add tests to demonstrate the various conditions you are targeting?

thanks!

@kgaikwad
Copy link
Member Author

@ohadlevy,

  1. why is this file in the host_details concern? I think it should be in the host controller?

Yes, your right! It should be in host controller. But when I tried to put method redirection_url_on_host_deletion in host controller.
After running a rubocop I am getting below error -
app/controllers/hosts_controller.rb:1:1: C: Class has too many lines. [769/760]
That's why I moved it to host_details concern.
Please let me know your suggestions on it.

  1. can you please add tests to demonstrate the various conditions you are targeting?

ok, I will add more tests and will update the PR.

@kgaikwad kgaikwad force-pushed the 20105_persist_search_filter_after_host_delete branch from 1305815 to 9b776d7 Compare February 18, 2018 17:57
@xprazak2
Copy link
Contributor

@kgaikwad, could you rebase pls?

@kgaikwad
Copy link
Member Author

kgaikwad commented Sep 3, 2018

@tbrisker, @xprazak2 ,

I have updated this PR.
Added two test cases. Also, added a change in Katello as hosts_controller extended in it through PR-7671

@jturel
Copy link
Contributor

jturel commented Jan 10, 2019

@kgaikwad can you rebase this?

@kgaikwad kgaikwad force-pushed the 20105_persist_search_filter_after_host_delete branch from 95369fe to 929a26d Compare January 14, 2019 13:12
@kgaikwad
Copy link
Member Author

Test failure seems irrelevant to this pull-request. Any suggestions?

Error Message
Capybara::Poltergeist::StatusFailError: Request to 'http://{ip}:41197/puppetclass_lookup_keys' failed to reach server, check DNS and/or server status...

@jturel
Copy link
Contributor

jturel commented Apr 16, 2019

I'm looking to move forward on Katello/katello#7671 and that needs to start here :)

@kgaikwad kgaikwad force-pushed the 20105_persist_search_filter_after_host_delete branch from 929a26d to 32e50a1 Compare April 16, 2019 09:03
@kgaikwad
Copy link
Member Author

@jturel, @tbrisker ,
Done with rebase. Got one test failed but I think it's irrelevant to my changes.

Test failure with error - Capybara::ElementNotFound: Unable to find link "Interfaces"...
Stacktrace

Capybara::ElementNotFound: Unable to find link "Interfaces"
    test/integration/shared/host_finders.rb:8:in `go_to_interfaces_tab'
    test/integration/host_js_test.rb:699:in `block (3 levels) 

@kgaikwad kgaikwad force-pushed the 20105_persist_search_filter_after_host_delete branch from 32e50a1 to 8a9212f Compare April 22, 2019 10:12
@xprazak2
Copy link
Contributor

@tbrisker, @ohadlevy any additional comments?

@ares ares self-assigned this Jul 24, 2019
@ares
Copy link
Member

ares commented Jul 24, 2019

[test foreman]

@kgaikwad kgaikwad force-pushed the 20105_persist_search_filter_after_host_delete branch from 8a9212f to 4f69608 Compare July 24, 2019 09:42
@ares ares dismissed stale reviews from ohadlevy and tbrisker July 24, 2019 11:09

stale review

Copy link
Member

@ares ares left a comment

Choose a reason for hiding this comment

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

@kgaikwad test failures seems unrelated and it fixes the issue for single host deletion. The original bug though asked for keeping the filter for bulk deletion I believe. I think the similar change should happen for submit_multiple_destroy controller action. The only change required is needed at https://github.com/theforeman/foreman/pull/4969/files#diff-1339af15c5b21b5bc6e557bbbda860c6R530, instead of redirect_to(hosts_path) you need to redirect_to(saved_redirect_url_or(send("#{controller_name}_url")))

I'm happy to merged then.

Copy link
Member

@ares ares left a comment

Choose a reason for hiding this comment

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

ACK pending jenkins

@ares
Copy link
Member

ares commented Jul 24, 2019

Thank you @kgaikwad, I'm happy for this to be merged, sorry for long waiting time.

@ares ares merged commit a7dc2ef into theforeman:develop Jul 24, 2019
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.

7 participants