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 saving changes after editing Satellite Provider #3676

Merged

Conversation

hstastna
Copy link

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

Fix saving changes (name) after editing Satellite Provider and returning to All Configuration Manager Providers page, under Configuration > Management > Providers.


Steps to reproduce the problem:

  1. Go to Configuration > Management > Providers, you should see All Configuration Management Providers page
  2. Click on any other node in the tree, in accordion (this is very important!)
  3. Go back to All Configuration Management Providers page so that you click on All Configuration Management Providers folder in the tree, in accordion
  4. Select the provider for editing by checking its checkbox and then, under Configuration, choose Edit Selected item
  5. In the editing page, change provider's name
  6. Try to save the changes by clicking on Save button
[----] F, [2018-03-23T09:56:10.400092 #2301:db699c] FATAL -- : Error caught: [NoMethodError] undefined method `[]' for nil:NilClass
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/application_controller/advanced_search.rb:37:in `adv_search_build'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/application_controller.rb:1458:in `get_view'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/application_controller/ci_processing.rb:199:in `process_show_list'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/provider_foreman_controller.rb:497:in `process_show_list'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/provider_foreman_controller.rb:326:in `default_node'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/provider_foreman_controller.rb:254:in `get_node_info'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/provider_foreman_controller.rb:341:in `leaf_record'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/mixins/manager_controller_mixin.rb:313:in `replace_right_cell'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/mixins/manager_controller_mixin.rb:57:in `save_provider'
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-4fbe8f024b4f/app/controllers/mixins/manager_controller_mixin.rb:234:in `edit'

Solution:
Added a simple condition to provider foreman controller to load_or_clear_adv_search method, as Providers' screens (under Config > Mgmt > Providers) don't support Advanced Search so it does not make sense to call listnav_search_selected method and clear_selected_search method in it. clear_selected_search method sets session[:adv_search] which makes problems later in adv_search_buildmethod: it will go to the wrong part of the if/else block and then @edit[@expkey][:expression] will not be properly set which will lead to error in https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/application_controller/advanced_search.rb#L37. This behavior is bad especially for root node there, other nodes can deal with it, so I am leaving the whole https://github.com/ManageIQ/manageiq-ui-classic/compare/master...hstastna:Edit_Save_All_Config_Manager_Providers?expand=1#diff-dd586a3167b910b76243edbecbbf0de5R97 there, not to break anything else, just added a simple condition. Saving,editing/displaying info of the provider tested also in other nodes, works well.


Step 4 from steps to reproduce:
provider_edit

Before: (after clicking on Save button, nothing happens)
provider_save

After: (successful saving the changes and returning to the appropriate page)
provider_save_ok

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

Fix saving changes (name) after editing Satellite Provider and returning to All
Configuration Manager Providers, under Configuration > Management > Providers.
@hstastna
Copy link
Author

@miq-bot add_label bug

@miq-bot miq-bot added the bug label Mar 23, 2018
@hstastna
Copy link
Author

@miq-bot add_label blocker

@miq-bot
Copy link
Member

miq-bot commented Mar 23, 2018

Checked commit hstastna@6648068 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@mzazrivec mzazrivec self-assigned this Apr 9, 2018
@mzazrivec mzazrivec added this to the Sprint 83 Ending Apr 9, 2018 milestone Apr 9, 2018
@mzazrivec mzazrivec merged commit 9942faf into ManageIQ:master Apr 9, 2018
@simaishi simaishi removed the blocker label May 18, 2018
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.

4 participants