-
Notifications
You must be signed in to change notification settings - Fork 356
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
prov_dialog customize - don't fail when no :sysprep_enabled #6953
Conversation
This code changed from conditions like... - if (@edit && @edit[:new] && @edit[:new][:sysprep_enabled] && @edit[:new][:sysprep_enabled][0] == "fields") || (@options && @options[:sysprep_enabled] && @options[:sysprep_enabled][0] == "fields") to one assignment... - edit_or_options = (@edit && @edit[:new] && @edit[:new][:sysprep_enabled]) || (@options && @options[:sysprep_enabled]) ...and conditions like... - if edit_or_options[0] == "fields" Which then crashes when trying to clone a RHV template, because `edit_or_options` is nil... Error caught: [ActionView::Template::Error] undefined method `[]' for nil:NilClass /opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-d44320707dfe/app/views/shared/views/_prov_dialog.html.haml:195:in `__opt_rh_cfme_gemset_bundler_gems_cfme_ui_classic_d________dfe_app_views_shared_views__prov_dialog_html_haml___2839729305696764418_47250275323280' The else branch doesn't look inside edit_or_options, so initializing to an empty array works as before. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1797706
Checked commit https://github.com/himdel/manageiq-ui-classic/commit/89152bd27dc232b72160ba35e5d0873b91192d9e with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint app/views/shared/views/_prov_dialog.html.haml
|
Well, any errrors? |
No errors in any console, but if I press the submit button, I'm getting this:
|
Oh, you're going from the Nah...same issue, tried with multiple RHV templates from Dan's DB 😕 |
Okay, any way to get there with the broken cloning? |
Well, if you already have a clone request in the db, maybe you just need to update created_at to see it? Or I can send you my db :) |
I'm not sure whis will help but... (
|
Or, you can find any similar request and clear |
@himdel following the steps from the BZ, I wasn't able to reproduce this issue on the latest master. Can you please verify and/or help me with reproducing? |
@skateman Can you be more specific? Which part did you fail to reproduce? And have you tried with the provided request? |
@skateman But most likely, you need to diff --git a/app/helpers/provision_customize_helper.rb b/app/helpers/provision_customize_helper.rb
index 40ef149208..d095a65d53 100644
--- a/app/helpers/provision_customize_helper.rb
+++ b/app/helpers/provision_customize_helper.rb
@@ -8,6 +8,7 @@ module ProvisionCustomizeHelper
end
def select_check?(workflow)
+ return true
(workflow.kind_of?(ManageIQ::Providers::Vmware::InfraManager::ProvisionWorkflow) ||
workflow.kind_of?(ManageIQ::Providers::Redhat::InfraManager::ProvisionWorkflow)) &&
!workflow.supports_pxe? && !workflow.supports_iso? to make sure the section is rendered. (It may render empty when when the right keys are not in options, not sure if that happens in real life too.) |
@himdel I have a new database and there I created this request:
I tried this, but also manually removed the No change after your suggested |
Well, then you need this diff: diff --git a/app/helpers/provision_customize_helper.rb b/app/helpers/provision_customize_helper.rb
index 40ef149208..d095a65d53 100644
--- a/app/helpers/provision_customize_helper.rb
+++ b/app/helpers/provision_customize_helper.rb
@@ -8,6 +8,7 @@ module ProvisionCustomizeHelper
end
def select_check?(workflow)
+ return true
(workflow.kind_of?(ManageIQ::Providers::Vmware::InfraManager::ProvisionWorkflow) ||
workflow.kind_of?(ManageIQ::Providers::Redhat::InfraManager::ProvisionWorkflow)) &&
!workflow.supports_pxe? && !workflow.supports_iso?
diff --git a/app/views/shared/views/_prov_dialog.html.haml b/app/views/shared/views/_prov_dialog.html.haml
index c9c5a70e3d..a07cced57f 100644
--- a/app/views/shared/views/_prov_dialog.html.haml
+++ b/app/views/shared/views/_prov_dialog.html.haml
@@ -183,8 +183,11 @@
:prefix => "/miq_request/",
:keys => keys})
- when :customize
+ = "EDIT: #{@edit.try(:[], :new).try(:to_json)}"
+ = "OPT: #{@options.try(:slice, :sysprep_enabled).try(:to_json)}"
- if select_check?(wf)
- - edit_or_options = (@edit && @edit[:new] && @edit[:new][:sysprep_enabled]) || (@options && @options[:sysprep_enabled])
+ - edit_or_options = (@edit && @edit[:new] && @edit[:new][:sysprep_enabled]) || (@options && @options[:sysprep_enabled]) || []
+ = "EO: #{edit_or_options.try(:to_json)}"
- keys = [:sysprep_enabled]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf, .. and tell me what's going on :) |
(and then remove the |
When displaying:
When editing:
|
Well, there's your answer then - there's |
Well, but the DB record doesn't have it 😕 |
¯\_(ツ)_/¯ I can't help you with the provider stuff, I suggest just mocking the data. |
I imported your DB dump and can't reproduce the issue with the only request you have available under |
prov_dialog customize - don't fail when no :sysprep_enabled (cherry picked from commit 158ca6f) https://bugzilla.redhat.com/show_bug.cgi?id=1797706
Ivanchuk backport details:
|
prov_dialog customize - don't fail when no :sysprep_enabled (cherry picked from commit 158ca6f) https://bugzilla.redhat.com/show_bug.cgi?id=1797706
Jansa backport details:
|
This code changed (#5774) from conditions like...
to one assignment...
...and conditions like...
Which then crashes when trying to clone a RHV template, because
edit_or_options
is nil...The else branch doesn't look inside edit_or_options, so initializing to an empty array works as before.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1797706