我在linux机器上运行了我的厨师服务器。我有我的工作站设置(刀配置) 在我的Windows 7机器上。我已进入命令刀节点列表。它工作正常,并显示我与我的服务器连接的节点。 但是当我尝试上传食谱时,它会显示以下错误。我用这个错误搜索了很多,弄错了这个有什么问题?
$knife cookbook upload mycookbook
ERROR: knife encountered an unexpected error
This may be a bug in the 'cookbook upload' knife command or plugin
Please collect the output of this command with the `-VV` option before filing a bug report.
Exception: NoMethodError: undefined method `on_create' for Chef::Cookbook::FileVendor:Class
任何建议......
INFO: Using configuration from F:/chef-repo/.chef/knife.rb
DEBUG: Chef::HTTP calling Chef::HTTP::JSONInput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::JSONToModelOutput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_request
DEBUG: Signing the request as admin
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_request
DEBUG: Initiating GET to serverurl?num_versions=all
DEBUG: ---- HTTP Request Header Data: ----
DEBUG: Accept: application/json
DEBUG: Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
DEBUG: X-OPS-SIGN: algorithm=sha1;version=1.0;
DEBUG: X-OPS-USERID: admin
DEBUG: X-OPS-TIMESTAMP: 2015-01-12T05:49:21Z
DEBUG: X-OPS-CONTENT-HASH: 2jmj7l5rSw0yVb/vlWAYkK/YBwk=
DEBUG: X-OPS-AUTHORIZATION-1: h8n6BlUYhBvdDhRgstYdefwD+g48+BNqRmiEKaHJ2xGjgfwQm79BPTZfp5rE
DEBUG: X-OPS-AUTHORIZATION-2: ABDYQEs8VPwPknNStKOiG6ldH1omKs3uaTB+dihAAvSaK45wtu0T+J3WMK5J
DEBUG: X-OPS-AUTHORIZATION-3: 3jJjujyC9DzkuNpyjj9UikVRi6a+39OVLaJkONu6il+w4L4TInHJ+ktxcmfw
DEBUG: X-OPS-AUTHORIZATION-4: rBKKgDIuDOJNRNauIYxwlSuSSOWqidum++fM+OIy9HxGSuxdX9Km71Z3txJa
DEBUG: X-OPS-AUTHORIZATION-5: Iie3p4PItta9iQbtCof9je8DYh/kJr0SgibWwHIb46XRia8W+GPywS3eI0WQ
DEBUG: X-OPS-AUTHORIZATION-6: 6wjRrXcUwuB2PbdRAAVzU/15mObukJohXBOxclbyzg==
DEBUG: HOST: hostname
DEBUG: X-REMOTE-REQUEST-ID: 921c227b-2a13-4a53-b44d-98d8efee0722
DEBUG: ---- End HTTP Request Header Data ----
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 200 OK
DEBUG: server: nginx/1.4.4
DEBUG: date: Mon, 12 Jan 2015 05:46:36 GMT
DEBUG: content-type: application/json
DEBUG: transfer-encoding: chunked
DEBUG: connection: close
DEBUG: x-ops-api-info: flavor=osc;version=11.0.2;erchef=1.4.1
DEBUG: content-encoding: gzip
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_response
DEBUG: HTTP server did not include a Content-Length header in response, cannot identify truncated downloads.
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_response
DEBUG: decompressing gzip response
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::JSONToModelOutput#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::JSONInput#handle_response
C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-11.6.0/lib/chef/knife/cookbook_upload.rb:179:in `cookbook_repo': undefined method `on_create' for Chef::C
ookbook::FileVendor:Class (NoMethodError)
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-11.6.0/lib/chef/knife/cookbook_upload.rb:163:in `block in cookbooks_to_upload'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-11.6.0/lib/chef/knife/cookbook_upload.rb:160:in `each'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-11.6.0/lib/chef/knife/cookbook_upload.rb:160:in `cookbooks_to_upload'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-11.6.0/lib/chef/knife/cookbook_upload.rb:119:in `run'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-12.0.0.rc.0-x86-mingw32/lib/chef/knife.rb:409:in `block in run_with_pretty_exceptions'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-12.0.0.rc.0-x86-mingw32/lib/chef/local_mode.rb:38:in `with_server_connectivity'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-12.0.0.rc.0-x86-mingw32/lib/chef/knife.rb:408:in `run_with_pretty_exceptions'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-12.0.0.rc.0-x86-mingw32/lib/chef/knife.rb:205:in `run'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-12.0.0.rc.0-x86-mingw32/lib/chef/application/knife.rb:139:in `run'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-12.0.0.rc.0-x86-mingw32/bin/knife:25:in `<top (required)>'
from C:/opscode/chefdk/embedded/bin/knife:23:in `load'
from C:/opscode/chefdk/embedded/bin/knife:23:in `<main>'
答案 0 :(得分:0)
真的不确定为什么你会混合使用这种厨师版本,你是否在chef-dk之外添加了宝石? :
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-11.6.0/lib/chef/knife/cookbook_upload.rb:119:in `run'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/chef-12.0.0.rc.0-x86-mingw32/lib/chef/knife.rb:409:in `block in run_with_pretty_exceptions'
我建议清理并重新安装chef-dk(保留你的pem文件和配置文件)。
您也可以尝试使用以下代码清理11.6版本:c:\opscode\chefdk\embedded\bin\gem uninstall chef -v 11.6.0
但不保证它可以解决您的问题(或者可能会造成其他问题)。