From b51cd0a4d3f177b19968119c23d2b168935bdf5f Mon Sep 17 00:00:00 2001 From: gardar Date: Wed, 25 Sep 2024 14:51:20 +0000 Subject: [PATCH] fixes #37474 - fix: pass variable id as url parameter and not body Signed-off-by: gardar --- .../api/v2/ansible_override_values_controller.rb | 12 +++--------- config/routes.rb | 6 +----- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/app/controllers/api/v2/ansible_override_values_controller.rb b/app/controllers/api/v2/ansible_override_values_controller.rb index 103dadc9..75fbf708 100644 --- a/app/controllers/api/v2/ansible_override_values_controller.rb +++ b/app/controllers/api/v2/ansible_override_values_controller.rb @@ -31,13 +31,13 @@ def create render 'api/v2/ansible_override_values/show' end - api :PUT, "/ansible_override_values", N_("Update an override value") - param :ansible_variable_id, :identifier, :required => true + api :PUT, "/ansible_override_values/:id", N_("Update an override value") + param :id, :identifier, :required => true param_group :ansible_override_value, :as => :update def update @ansible_variable = AnsibleVariable.authorized(:edit_ansible_variables). - find_by(:id => params[:ansible_variable_id].to_i) + find_by(:id => params[:id].to_i) @override_value = @ansible_variable.lookup_values.find_by(:match => lookup_value_params['override_value']['match']) if @override_value @@ -62,12 +62,6 @@ def destroy end end - private - - def lookup_value_params - params.permit(:ansible_variable_id, override_value: [:match, :value]) - end - def resource_name 'ansible_variable' end diff --git a/config/routes.rb b/config/routes.rb index d0e7eae0..657962f0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -100,11 +100,7 @@ end end - resources :ansible_override_values, :only => [:create, :destroy] do - collection do - put :update - end - end + resources :ansible_override_values, :only => [:create, :destroy, :update] resources :ansible_inventories, :only => [] do collection do