【问题标题】:Can't Upload Cookbooks from windows workstation无法从 Windows 工作站上传食谱
【发布时间】:2016-12-19 19:57:59
【问题描述】:

我已经在 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>'

【问题讨论】:

  • 如果你在mycookbook目录下windows下,移开,cd ..knife必须把dir改成它,windows下不行
  • 如果@Tensibai 解决方案对您不起作用,您可以尝试使用-VV 标志运行命令并提供更多信息吗?
  • 是的。我已经从我的食谱目录中尝试了这个命令,并使用 -VV 标志提交了错误。

标签: chef-infra


【解决方案1】:

真的不确定你为什么要混合厨师版本,你是否在 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 文件和配置文件)。

您也可以尝试使用:c:\opscode\chefdk\embedded\bin\gem uninstall chef -v 11.6.0 清理 11.6 版本,但不能保证它会解决您的问题(或者可能会产生其他问题)。

【讨论】:

  • 我在同一台 Windows 机器上安装了我的 Chef 客户端代理。我通过上面的命令c:\opscode\chefdk\embedded\bin\gem uninstall chef -v 11.6.0 Knife node list 命令清理了11.6版本后也不起作用。
  • 重做一个全新的安装,你的路径 Env var 被旧的引用和其他边缘情况搞砸了。无论如何 chef-client 是 chef-dk 的一部分
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-08-08
  • 2018-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多