Skip to content

Commit

Permalink
fixes #37474 - fix: pass variable id as url parameter and not body
Browse files Browse the repository at this point in the history
Signed-off-by: gardar <[email protected]>
  • Loading branch information
gardar committed Sep 25, 2024
1 parent cbd71d6 commit b51cd0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
12 changes: 3 additions & 9 deletions app/controllers/api/v2/ansible_override_values_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 1 addition & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b51cd0a

Please sign in to comment.