chef / chef/chef-server

Disabling old-style registration results in error 500

Open
#139 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Good First Issue Status: To be prioritized Triage: Confirmed Triage: Try Reproducing Type: Bug
Dominant language
Erlang
Stars
303
Forks
211
Avg merge
1d 8h
Merged PRs (30d)
5

Description

When I want to bootstrap a new node after disabling old-style registration, I get a 500:

knife bootstrap <new-node> -r "role[base]" 
Creating new client for 
ERROR: Server returned error 500 for https://*******.dock42.com/clients, retrying 1/5 in 4s
ERROR: Server returned error 500 for https://*******.dock42.com/clients, retrying 2/5 in 7s
ERROR: Server returned error 500 for https://*******.dock42.com/clients, retrying 3/5 in 16s
==> /var/log/opscode/opscode-erchef/erchef.log <==
2015-04-06 12:51:14.716 [error] {<<"method=POST; path=/clients; status=500; ">>,{error,badarg,[{re,run,[null,{re_pattern,0,0,<<69,82,67,80,91,0,0,0,16,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,0,39,25,77,0,0,0,0,0,96,255,3,254,255,255,135,254,255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,71,26,84,0,39,0>>}],[]},{chef_client,valid_name,1,[{file,"src/chef_client.erl"},{line,293}]},{chef_client,parse_binary_json,3,[{file,"src/chef_client.erl"},{line,232}]},{chef_wm_clients,validate_request,3,[{file,"src/chef_wm_clients.erl"},{line,89}]},{oc_chef_wm_base,malformed_request,2,[{file,"src/oc_chef_wm_base.erl"},{line,753}]},{webmachine_resource,resource_call,3,[{file,"src/webmachine_resource.erl"},{line,186}]},{webmachine_resource,do,3,[{file,"src/webmachine_resource.erl"},{line,142}]},{webmachine_decision_core,resource_call,1,[{file,"src/webmachine_decision_core.erl"},{line,48}]}]}}

==> /var/log/opscode/opscode-erchef/crash.log <==
2015-04-06 12:51:14 =ERROR REPORT====
{<<"method=POST; path=/clients; status=500; ">>,{error,badarg,[{re,run,[null,{re_pattern,0,0,<<69,82,67,80,91,0,0,0,16,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,0,39,25,77,0,0,0,0,0,96,255,3,254,255,255,135,254,255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,71,26,84,0,39,0>>}],[]},{chef_client,valid_name,1,[{file,"src/chef_client.erl"},{line,293}]},{chef_client,parse_binary_json,3,[{file,"src/chef_client.erl"},{line,232}]},{chef_wm_clients,validate_request,3,[{file,"src/chef_wm_clients.erl"},{line,89}]},{oc_chef_wm_base,malformed_request,2,[{file,"src/oc_chef_wm_base.erl"},{line,753}]},{webmachine_resource,resource_call,3,[{file,"src/webmachine_resource.erl"},{line,186}]},{webmachine_resource,do,3,[{file,"src/webmachine_resource.erl"},{line,142}]},{webmachine_decision_core,resource_call,1,[{file,"src/webmachine_decision_core.erl"},{line,48}]}]}}

==> /var/log/opscode/opscode-erchef/current <==
2015-04-06_10:51:14.72501 [error] {<<"method=POST; path=/clients; status=500; ">>,{error,badarg,[{re,run,[null,{re_pattern,0,0,<<69,82,67,80,91,0,0,0,16,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,0,39,25,77,0,0,0,0,0,96,255,3,254,255,255,135,254,255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,71,26,84,0,39,0>>}],[]},{chef_client,valid_name,1,[{file,"src/chef_client.erl"},{line,293}]},{chef_client,parse_binary_json,3,[{file,"src/chef_client.erl"},{line,232}]},{chef_wm_clients,validate_request,3,[{file,"src/chef_wm_clients.erl"},{line,89}]},{oc_chef_wm_base,malformed_request,2,[{file,"src/oc_chef_wm_base.erl"},{line,753}]},{webmachine_resource,resource_call,3,[{file,"src/webmachine_resource.erl"},{line,186}]},{webmachine_resource,do,3,[{file,"src/webmachine_resource.erl"},{line,142}]},{webmachine_decision_core,resource_call,1,[{file,"src/webmachine_decision_core.erl"},{line,48}]}]}}

==> /var/log/opscode/nginx/access.log <==
******* - - [06/Apr/2015:12:51:14 +0200]  "POST /clients HTTP/1.1" 500 "0.027" 36 "-" "Chef Knife/12.2.1 (ruby-2.1.5-p273; ohai-8.2.0; x86_64-darwin14.0; +http://opscode.com)" "127.0.0.1:8000" "500" "0.007" "12.2.1" "algorithm=sha1;version=1.0;" "vogl" "2015-04-06T10:46:39Z" "X9qKxCeT7YDiMqp3ajKF+ajFw6s=" 1548

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/chef_client.erl at valid_name/1 and parse_binary_json/3, then follow validation through src/chef_wm_clients.erl. Reproduce the POST /clients request after disabling old-style registration and use the erchef and nginx logs to confirm the failure is handled without returning HTTP 500.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang, ruby
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.