[chef] Re: Re: 400 bad request


Chronological Thread 
  • From: Michael Pereira < >
  • To: Daniel DeLeo < >
  • Cc:
  • Subject: [chef] Re: Re: 400 bad request
  • Date: Mon, 10 Aug 2015 09:10:22 -0400


This means that your chef-client run is generally working okay, but when Chef attempts to save the node data back to the server, the submitted data is somehow invalid. There are several possibilities but the most common is that there are invalid characters in the node data (JSON data must be valid UTF-8). Several such bugs have been fixed in recent versions of Chef, you should try installing a newer version and see if that resolves the issue. If you’re totally unable to upgrade, you can try pretty printing the node data and looking for any non-ascii characters; you might be able to delete that data via a cookbook or prevent ohai from loading it with config.


Hi,

Can you please share more information about pretty printing the node-data?

I am having the same error but on a node that was cloned from an existing chef-managed node, from which I removed the content under /et/chef/. Whenever I try to bootstrap it or run chef-client, I get the following errors:


:~/chef-repo
[master]$ sudo chef-client
Starting Chef Client, version 12.4.1
/opt/chef/embedded/apps/chef/lib/chef/mixin/path_sanity.rb:25: warning: Insecure world writable dir /nis3/home in PATH, mode 040777
Creating a new client identity for client-machine using the validator key.
================================================================================
Chef encountered an error attempting to create the client "client-machine"
================================================================================
Invalid Request Data:
---------------------
The data in your request was invalid (HTTP 400).
Server Response:
----------------
Since Server API v1, all keys must be updated via the keys endpoint.

Running handlers:
[2015-08-07T15:25:57-04:00] ERROR: Running exception handlers
Running handlers complete
[2015-08-07T15:25:57-04:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 1.552398 seconds
[2015-08-07T15:25:57-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-08-07T15:25:57-04:00] ERROR: 400 "Bad Request"
[2015-08-07T15:25:57-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
:~/chef-repo
[master]$ sudo cat /var/chef/cache/chef-stacktrace.out
Generated at 2015-08-07 15:25:57 -0400
Net::HTTPServerException: 400 "Bad Request"
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:119:in `error!'
/opt/chef/embedded/apps/chef/lib/chef/http.rb:145:in `request'
/opt/chef/embedded/apps/chef/lib/chef/http.rb:118:in `put'
/opt/chef/embedded/apps/chef/lib/chef/api_client/registration.rb:99:in `update'
/opt/chef/embedded/apps/chef/lib/chef/api_client/registration.rb:89:in `rescue in create_or_update'
/opt/chef/embedded/apps/chef/lib/chef/api_client/registration.rb:84:in `create_or_update'
/opt/chef/embedded/apps/chef/lib/chef/api_client/registration.rb:57:in `run'
/opt/chef/embedded/apps/chef/lib/chef/client.rb:608:in `register'
/opt/chef/embedded/apps/chef/lib/chef/client.rb:253:in `run'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:270:in `block in fork_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:258:in `fork'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:258:in `fork_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:224:in `block in run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/local_mode.rb:39:in `with_server_connectivity'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:212:in `run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/client.rb:402:in `block in interval_run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/client.rb:392:in `loop'
/opt/chef/embedded/apps/chef/lib/chef/application/client.rb:392:in `interval_run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/client.rb:382:in `run_application'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:60:in `run'
/opt/chef/embedded/apps/chef/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:55:in `load'
/usr/bin/chef-client:55:in `<main>'

The chef server version is 12.1.0-1 and the client-machine has chef-12.4.1-1.el5

Thanks for your help

--
Michael Pereira
(201) 855-9607



Archive powered by MHonArc 2.6.16.

§