Skip to content

Commit

Permalink
Fixes #38031 - Use the same routes constraints as Foreman
Browse files Browse the repository at this point in the history
  • Loading branch information
ofedoren committed Nov 21, 2024
1 parent 6a9bae2 commit 498649e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
:defaults => { apiv: 'v2' },
:apiv => /v2/,
:constraints => ApiConstraints.new(version: 2, default: true) do
constraints(:id => %r{[^\/]+}) do
resources :hosts, :except => [:new, :edit] do
constraints(:id => /[^\/]+/) do

Check failure on line 10 in config/routes.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Style/RegexpLiteral: Use `%r` around regular expression.
resources :hosts, :only => [] do
member do
post :play_roles
get :ansible_roles
post :assign_ansible_roles
put 'ansible_roles/:ansible_role_id', :to => 'hosts#add_ansible_role', :constraints => { id: %r{[^\/]+} }
delete 'ansible_roles/:ansible_role_id', :to => 'hosts#remove_ansible_role', :constraints => { id: %r{[^\/]+} }
put 'ansible_roles/:ansible_role_id', :to => 'hosts#add_ansible_role', :constraints => { id: /[^\/]+/ }

Check failure on line 16 in config/routes.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Style/RegexpLiteral: Use `%r` around regular expression.
delete 'ansible_roles/:ansible_role_id', :to => 'hosts#remove_ansible_role', :constraints => { id: /[^\/]+/ }

Check failure on line 17 in config/routes.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Style/RegexpLiteral: Use `%r` around regular expression.
end
collection do
post :multiple_play_roles
Expand All @@ -25,8 +25,8 @@
post :play_roles
get :ansible_roles
post :assign_ansible_roles
put 'ansible_roles/:ansible_role_id', :to => 'hostgroups#add_ansible_role', :constraints => { id: %r{[^\/]+} }
delete 'ansible_roles/:ansible_role_id', :to => 'hostgroups#remove_ansible_role', :constraints => { id: %r{[^\/]+} }
put 'ansible_roles/:ansible_role_id', :to => 'hostgroups#add_ansible_role', :constraints => { id: /[^\/]+/ }

Check failure on line 28 in config/routes.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Style/RegexpLiteral: Use `%r` around regular expression.
delete 'ansible_roles/:ansible_role_id', :to => 'hostgroups#remove_ansible_role', :constraints => { id: /[^\/]+/ }

Check failure on line 29 in config/routes.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Style/RegexpLiteral: Use `%r` around regular expression.
end
collection do
post :multiple_play_roles
Expand All @@ -36,7 +36,7 @@
end
end
scope '/ansible' do
constraints(:id => %r{[^\/]+}) do
constraints(:id => /[^\/]+/) do

Check failure on line 39 in config/routes.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Style/RegexpLiteral: Use `%r` around regular expression.
resources :hosts, :only => [] do
member do
get :play_roles
Expand Down

0 comments on commit 498649e

Please sign in to comment.