zendesk/samson

500 errors on deploy group update

danihodovic opened this issue · 8 comments

Started PATCH "/deploy_groups/382f0cd6-9fde-5113-9990-cf7b98058872" for 127.0.0.1 at 2019-03-23 15:06:15 +0000
Processing by DeployGroupsController#update as HTML
  Parameters: {"deploy_group"=>{"permalink"=>"382f0cd6-9fde-5113-9990-cf7b98058872", "environment_id"=>5, "name_sortable"=>"dg 00382f00000cd00006-00009fde-05113-09990-cf00007b98058872", "env_value"=>"[FILTERED]", "vault_server_id"=>nil, "name"=>"changed 382f0cd6-9fde-5113-9990-cf7b98058872"}, "id"=>"382f0cd6-9fde-5113-9990-cf7b98058872"}
  Doorkeeper::AccessToken Load (0.1ms)  SELECT  "oauth_access_tokens".* FROM "oauth_access_tokens" WHERE "oauth_access_tokens"."token" = ? LIMIT ?  [["token", "token"], ["LIMIT", 1]]
  Doorkeeper::AccessToken Load (0.1ms)  SELECT  "oauth_access_tokens".* FROM "oauth_access_tokens" WHERE "oauth_access_tokens"."refresh_token" = ? LIMIT ?  [["refresh_token", ""], ["LIMIT", 1]]
   (0.1ms)  begin transaction
   (0.1ms)  commit transaction
  User Load (0.2ms)  SELECT  "users".* FROM "users" WHERE "users"."deleted_at" IS NULL AND "users"."id" = ? LIMIT ?  [["id", 1], ["LIMIT", 1]]
  DeployGroup Load (0.2ms)  SELECT  "deploy_groups".* FROM "deploy_groups" WHERE "deploy_groups"."deleted_at" IS NULL AND "deploy_groups"."permalink" = ? ORDER BY "deploy_groups"."name_sortable" ASC LIMIT ?  [["permalink", "382f0cd6-9fde-5113-9990-cf7b98058872"], ["LIMIT", 1]]
Completed 500 Internal Server Error in 8ms (ActiveRecord: 0.7ms)



ActionController::UnpermittedParameters (found unpermitted parameter: :name_sortable):

app/controllers/deploy_groups_controller.rb:81:in `resource_params'
app/controllers/resource_controller.rb:67:in `block (2 levels) in update'
app/controllers/resource_controller.rb:65:in `update'

also not sure how you get that 500 error ...
app/controllers/concerns/json_exceptions.rb should take care of it ... and works for me :/
... did you do something weird ?

curl -X PATCH -H 'Authorization: Bearer 16a0cbda856656a98bc4b7825985dc726d5512cdb7699811e76837965b501c95' 'http://localhost:3000/deploy_groups/foo.json?deploy_group%5Bname_sortable%5D=bar'
{"status":400,"error":{"name_sortable":["is not permitted"]}}

... did you do something weird ?

Define 'something weird'. Here is the PR and the failed build: https://travis-ci.org/danihodovic/ansible-samson/builds/510228314#L1910

The Samson logs are in the issue description above.

I might be running it in dev mode.

That is correct my friend. JSON support for deploy groups had not been added until recently.

https://github.com/danihodovic/ansible-samson/blob/411c7f55baf67380c364a0abf4361be05627d36b/library/samson_deploy_group.py#L63