Project

General

Profile

Actions

Bug #21771

closed

salt_keys api using wrong variable name for updates

Added by Dominic Schlegel over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

the salt_keys api currently is referencing a variable in the updated definition that is not being filled up so the request will fail with below error:

2017-11-27T09:02:28 1f1c2ec8 [app] [I] Started PUT "/salt/api/v2/salt_keys/my-smart-proxy/my-test-server" for 10.0.X.X at 2017-11-27 09:02:28 +0100
2017-11-27T09:02:28 1f1c2ec8 [app] [I] Processing by ForemanSalt::Api::V2::SaltKeysController#update as JSON
2017-11-27T09:02:28 1f1c2ec8 [app] [I]   Parameters: {"state"=>"rejected", "apiv"=>"v2", "smart_proxy_id"=>"my-smart-proxy", "name"=>"my-test-server", "salt_key"=>{"state"=>"rejected"}}
2017-11-27T09:02:28 1f1c2ec8 [app] [I] Current user: mypersonaluser (regular user)
2017-11-27T09:02:28 1f1c2ec8 [app] [W] Action failed
 | NoMethodError: undefined method `[]' for nil:NilClass
 | /usr/share/foreman/vendor/ruby/2.0.0/gems/foreman_salt-8.0.2/app/controllers/foreman_salt/api/v2/salt_keys_controller.rb:24:in `update'

I found out that line 24 is referencing case params[:key][:state] while it should be params[:salt_key][:state]

Actions #1

Updated by The Foreman Bot over 6 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_salt/pull/74 added
Actions #2

Updated by Anonymous over 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF