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 #37849 - Support Rails 7.0 #582

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions app/services/foreman_openscap/lookup_key_overrider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ def override

def handle_config_not_available(config)
return true if config.available?
@policy.errors[:deploy_by] <<
@policy.errors.add(:deploy_by,
_("%{type} was selected to deploy policy to clients, but %{type} is not available. Are you missing a plugin?") %
{ :type => config.type.to_s.camelize }
)
false
end

def handle_config_item_not_available(config, item)
return true if item
err = _("Required %{msg_name} %{class} was not found, please ensure it is imported first.") %
{ :class => config.config_item_name, :msg_name => config.msg_name }
@policy.errors[:base] << err
@policy.errors.add(:base, err)
false
end

Expand All @@ -34,7 +35,7 @@ def handle_missing_lookup_keys(config, key_names)
err = _("The following %{key_name} were missing for %{item_name}: %{key_names}. Make sure they are imported before proceeding.") %
{ :key_name => config.lookup_key_plural_name, :key_names => key_names, :item_name => config.config_item_name }

@policy.errors[:base] << err
@policy.errors.add(:base, err)
false
end

Expand All @@ -52,9 +53,9 @@ def handle_policies_param_override(config, param)

def handle_param_override(config, param)
if param.changed? && !param.save
@policy.errors[:base] <<
@policy.errors.add(:base,
_('Failed to save when overriding parameters for %{config_tool}, cause: %{errors}') %
{ :config_tool => config.type, :errors => param.errors.full_messages.join(', ') }
{ :config_tool => config.type, :errors => param.errors.full_messages.join(', ') })
return false
end
true
Expand Down
25 changes: 9 additions & 16 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

namespace :api, :defaults => { :format => 'json' } do
scope "(:apiv)", :module => :v2, :defaults => { :apiv => 'v2' },
:apiv => /v1|v2/, :constraints => ApiConstraints.new(:version => 2, :default => true) do
:apiv => /v2/, :constraints => ApiConstraints.new(:version => 2, :default => true) do
namespace :compliance do
resources :scap_contents, :except => %i[new edit] do
member do
Expand Down Expand Up @@ -95,6 +95,14 @@
post 'arf_reports/:cname/:policy_id/:date', \
:constraints => { :cname => /[^\/]+/ }, :to => 'arf_reports#create'
end

constraints(:id => %r{[^\/]+}) do
resources :hosts, :except => [:new, :edit] do
member do
get :policies_enc
end
end
end
end
end
end
Expand All @@ -113,19 +121,4 @@
post 'openscap_proxy_changed'
end
end

namespace :api do
scope "(:api_version)", :module => :v2,
:defaults => { :api_version => 'v2' },
:api_version => /v2/,
:constraints => ApiConstraints.new(:version => 2, :default => true) do
constraints(:id => %r{[^\/]+}) do
resources :hosts, :only => [] do
member do
get :policies_enc
end
end
end
end
end
end
1 change: 0 additions & 1 deletion test/functional/openscap_proxies_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'test_plugin_helper'
require 'application_helper'

class OpenscapProxiesControllerTest < ActionController::TestCase
include ActionView::Helpers::DateHelper
Expand Down
Loading