app/helpers/katello/concerns/settings_helper_extensions.rb in katello-3.5.2 vs app/helpers/katello/concerns/settings_helper_extensions.rb in katello-3.6.0.rc1
- old
+ new
@@ -1,44 +1,53 @@
module Katello
module Concerns
module SettingsHelperExtensions
extend ActiveSupport::Concern
- included do
- alias_method_chain :value, :katello
- end
+ module Overrides
+ # rubocop:disable MethodLength
+ def value(setting)
+ return super(setting) unless [
+ 'default_download_policy',
+ 'katello_default_finish',
+ 'katello_default_iPXE',
+ 'katello_default_provision',
+ 'katello_default_ptable',
+ 'katello_default_PXELinux',
+ 'katello_default_PXEGrub',
+ 'katello_default_PXEGrub2',
+ 'katello_default_user_data',
+ 'katello_default_kexec',
+ 'katello_default_atomic_provision'
+ ].include?(setting.name)
- def value_with_katello(setting)
- return value_without_katello(setting) unless [
- 'default_download_policy',
- 'katello_default_finish',
- 'katello_default_iPXE',
- 'katello_default_provision',
- 'katello_default_ptable',
- 'katello_default_PXELinux',
- 'katello_default_user_data',
- 'katello_default_kexec',
- 'katello_default_atomic_provision'
- ].include?(setting.name)
-
- case setting.name
- when "default_download_policy"
- edit_select(setting, :value, :select_values => Hash[::Runcible::Models::YumImporter::DOWNLOAD_POLICIES.collect { |p| [p, p] }].to_json)
- when "katello_default_finish"
- edit_select(setting, :value, :select_values => katello_template_setting_values("finish"))
- when "katello_default_iPXE"
- edit_select(setting, :value, :select_values => katello_template_setting_values("iPXE"))
- when "katello_default_provision", "katello_default_atomic_provision"
- edit_select(setting, :value, :select_values => katello_template_setting_values("provision"))
- when "katello_default_ptable"
- edit_select(setting, :value, :select_values => Hash[Template.all.where(:type => "Ptable").map { |tmp| [tmp[:name], tmp[:name]] }].to_json)
- when "katello_default_PXELinux"
- edit_select(setting, :value, :select_values => katello_template_setting_values("PXELinux"))
- when "katello_default_user_data"
- edit_select(setting, :value, :select_values => katello_template_setting_values("user_data"))
- when "katello_default_kexec"
- edit_select(setting, :value, :select_values => katello_template_setting_values("kexec"))
+ case setting.name
+ when "default_download_policy"
+ edit_select(setting, :value, :select_values => Hash[::Runcible::Models::YumImporter::DOWNLOAD_POLICIES.collect { |p| [p, p] }].to_json)
+ when "katello_default_finish"
+ edit_select(setting, :value, :select_values => katello_template_setting_values("finish"))
+ when "katello_default_iPXE"
+ edit_select(setting, :value, :select_values => katello_template_setting_values("iPXE"))
+ when "katello_default_provision", "katello_default_atomic_provision"
+ edit_select(setting, :value, :select_values => katello_template_setting_values("provision"))
+ when "katello_default_ptable"
+ edit_select(setting, :value, :select_values => Hash[Template.all.where(:type => "Ptable").map { |tmp| [tmp[:name], tmp[:name]] }].to_json)
+ when "katello_default_PXELinux"
+ edit_select(setting, :value, :select_values => katello_template_setting_values("PXELinux"))
+ when "katello_default_PXEGrub"
+ edit_select(setting, :value, :select_values => katello_template_setting_values("PXEGrub"))
+ when "katello_default_PXEGrub2"
+ edit_select(setting, :value, :select_values => katello_template_setting_values("PXEGrub2"))
+ when "katello_default_user_data"
+ edit_select(setting, :value, :select_values => katello_template_setting_values("user_data"))
+ when "katello_default_kexec"
+ edit_select(setting, :value, :select_values => katello_template_setting_values("kexec"))
+ end
end
+ end
+
+ included do
+ prepend Overrides
end
private
def katello_template_setting_values(name)