Reputation: 3745
Chef Server: 12.0.8
ChefDK (Windows): 2.1.11
C:\Data\SVN\dev\trunk\chef-repo>chef --version
Chef Development Kit Version: 2.1.11
chef-client version: 13.2.20
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.0
kitchen version: 1.17.0
inspec version: 1.33.1
This problem started out with the error:
C:\Data\SVN\dev\trunk\chef-repo>knife cookbook upload acl
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/json_compat.rb:35:in `rescue in parse': input must be a string or IO (Chef::Exceptions::JSON::ParseError)
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/json_compat.rb:33:in `parse'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/json_compat.rb:40:in `from_json'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/knife.rb:511:in `humanize_http_exception'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/knife.rb:455:in `humanize_exception'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/knife.rb:446:in `rescue in run_with_pretty_exceptions'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/knife.rb:436:in `run_with_pretty_exceptions'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/knife.rb:219:in `run'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/lib/chef/application/knife.rb:156:in `run'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.2.20-universal-mingw32/bin/knife:25:in `<top (required)>'
from C:/opscode/chefdk/bin/knife:275:in `load'
from C:/opscode/chefdk/bin/knife:275:in `<main>'
This was suddenly happening for all cookbooks.
So we added verbose logging to the knife command:
knife cookbook upload acl -V -V
which showed the error is actually coming from a mismatch between ChefDK and the server API versions:
invalid-x-ops-server-api-version: "Specified version 2 not supported","min_version":0,"max_version":1
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 406 Not Acceptable
DEBUG: server: openresty/1.7.10.1
DEBUG: date: Tue, 26 Sep 2017 23:33:12 GMT
DEBUG: content-length: 122
DEBUG: connection: close
DEBUG: x-ops-api-info: flavor=cs;version=12.0.0;oc_erchef=1.6.4
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: ---- HTTP Response Body ----
DEBUG: {"error":"invalid-x-ops-server-api-version","message":"Specified version 2 not supported","min_version":0,"max_version":1}
DEBUG: ---- End HTTP Response Body -----
Does this mean that ChefDK v2 is not compatible with Chef Server v12?
According to their documentation, Chef 12 supports API versions 0 to 3:
https://github.com/chef/chef-rfc/blob/master/rfc041-server-api-versioning.md
Upvotes: 0
Views: 292
Reputation: 54211
This was a bug in some early releases of ChefDK 2.x. It has since been corrected in all cases we know about. Please let us know if this still happens with the current ChefDK (2.3.4).
Upvotes: 0