在完整全新安装Windows Server 2012R2上遇到此问题。如果我只是运行chef-client
或运行chef-client -c C:\chef\client.rb
,我会得到同样的结果。我已经验证的client.rb是默认路径,包含:
log_level :debug
log_location STDOUT
chef_server_url 'https://chef.t93.us/organizations/<orgname>'
validation_client_name '<orgname>-validator'
validation_key 'C:\chef\<orgname>-validator.pem'
ssl_ca_file 'C:\chef\<dom_ain>.crt'
<>
的字符串具有替换<>
的正确值。
我总是得到以下输出,日志级别设置为debug(使用cli开关,因为client.rb中的日志值没有生效):
[2016-04-06T16:57:36-07:00] DEBUG: Sleeping for 0 seconds
[2016-04-06T16:57:36-07:00] INFO: *** Chef 12.8.1 ***
[2016-04-06T16:57:36-07:00] INFO: Chef-client pid: 2924
[2016-04-06T16:57:36-07:00] DEBUG: Chef-client request_id: 1101fdac-22de-458c-9b8b-d724a85e1879
[2016-04-06T16:57:36-07:00] DEBUG: Could not load sigar gem. Skipping NetworkRoutes plugin
[2016-04-06T16:57:37-07:00] DEBUG: Could not load sigar gem. Skipping NetworkListeners plugin
[2016-04-06T16:57:37-07:00] DEBUG: [inet] Using default interface 0x13 and default gateway 10.10.10.1 to set the default ip to 10.10.10.14
[2016-04-06T16:57:37-07:00] DEBUG: setting macaddress to '82:1B:DC:34:31:3F' from interface '0x13' for family 'inet'
[2016-04-06T16:57:37-07:00] DEBUG: [inet6] no default interface, picking the first ipaddress
[2016-04-06T16:57:37-07:00] DEBUG: No data to collect for plugin LSB. Continuing...
[2016-04-06T16:57:38-07:00] DEBUG: azure plugin: No hints present for azure and doesn't appear to be azure.
[2016-04-06T16:57:39-07:00] DEBUG: ec2 plugin: has_ec2_dmi? == false
[2016-04-06T16:57:39-07:00] DEBUG: ec2 plugin: has_xen_mac? == false
[2016-04-06T16:57:39-07:00] DEBUG: ec2 plugin: has_ec2metadata_bin? == false
[2016-04-06T16:57:39-07:00] DEBUG: ec2 plugin: looks_like_ec2? == false
[2016-04-06T16:57:39-07:00] DEBUG: Plugin GCE threw #<SocketError: getaddrinfo: No such host is known. >
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/mixin/gce_metadata.rb:30:in `pack_sockaddr_in'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/mixin/gce_metadata.rb:30:in `can_metadata_connect?'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/plugins/gce.rb:30:in `has_gce_metadata?'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/plugins/gce.rb:39:in `looks_like_gce?'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/plugins/gce.rb:43:in `block (2 levels) in <main>'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/dsl/plugin/versionvii.rb:90:in `instance_eval'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/dsl/plugin/versionvii.rb:90:in `run_plugin'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/dsl/plugin.rb:98:in `run'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/dsl/plugin.rb:169:in `safe_run'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/runner.rb:84:in `run_v7_plugin'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/runner.rb:43:in `run_plugin'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/system.rb:98:in `block in run_plugins'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/system.rb:97:in `each'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/system.rb:97:in `run_plugins'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/ohai-8.11.1/lib/ohai/system.rb:75:in `all_plugins'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:559:in `run_ohai'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:262:in `run'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:445:in `block in interval_run_chef_client'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `loop'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `interval_run_chef_client'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:424:in `run_application'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:58:in `run'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/bin/chef-client:26:in `<top (required)>'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/bin/chef-client:60:in `load'
[2016-04-06T16:57:39-07:00] DEBUG: C:/opscode/chef/bin/chef-client:60:in `<main>'
[2016-04-06T16:57:39-07:00] DEBUG: eucalyptus plugin: has_euca_mac? == false
[2016-04-06T16:57:39-07:00] DEBUG: eucalyptus plugin: looks_like_euca? == false
[2016-04-06T16:57:39-07:00] DEBUG: linode plugin: looks_like_linode? == false
[2016-04-06T16:57:39-07:00] DEBUG: NOT ohai openstack
[2016-04-06T16:57:39-07:00] DEBUG: digitalocean plugin: No hints present for and doesn't look like digitalocean
[2016-04-06T16:57:39-07:00] DEBUG: softlayer plugin: looks_like_softlayer? == false
[2016-04-06T16:57:39-07:00] DEBUG: No data to collect for plugin PS. Continuing...
[2016-04-06T16:57:39-07:00] DEBUG: No data to collect for plugin Filesystem2. Continuing...
[2016-04-06T16:57:39-07:00] DEBUG: No data to collect for plugin SystemProfile. Continuing...
[2016-04-06T16:57:39-07:00] DEBUG: No data to collect for plugin InitPackage. Continuing...
[2016-04-06T16:57:39-07:00] DEBUG: ip_scopes: cannot load gem, plugin disabled: cannot load such file -- ipaddr_extensions
[2016-04-06T16:57:39-07:00] DEBUG: Failed to find sshd configuration file
[2016-04-06T16:57:39-07:00] DEBUG: No data to collect for plugin BlockDevice. Continuing...
[2016-04-06T16:57:39-07:00] DEBUG: No data to collect for plugin Mdadm. Continuing...
[2016-04-06T16:57:39-07:00] DEBUG: No data to collect for plugin Zpools. Continuing...
[2016-04-06T16:57:39-07:00] DEBUG: No data to collect for plugin VMware. Continuing...
[2016-04-06T16:57:39-07:00] INFO: Client key C:\chef\client.pem is not present - registering
[2016-04-06T16:57:39-07:00] WARN: Failed to read the private key C:\chef\validation.pem: #<Errno::ENOENT: No such file or directory - C:\chef\validation.pem>
[0m
================================================================================[0m
[31mChef encountered an error attempting to create the client "2012r2dev.JLA.local"[0m
================================================================================[0m
[0mPrivate Key Not Found:[0m
----------------------[0m
Your private key could not be loaded. If the key file exists, ensure that it is
[0mreadable by chef-client.
[0m
[0mRelevant Config Settings:[0m
-------------------------[0m
validation_key "C:\chef\validation.pem"
[0m
[0m[2016-04-06T16:57:39-07:00] DEBUG: Re-raising exception: Chef::Exceptions::PrivateKeyMissing - I cannot read C:\chef\validation.pem, which you told me to use to sign requests!
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http/authenticator.rb:86:in `rescue in load_signing_key'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http/authenticator.rb:76:in `load_signing_key'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http/authenticator.rb:40:in `initialize'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http.rb:93:in `new'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http.rb:93:in `block in initialize'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http.rb:92:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http.rb:92:in `initialize'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/server_api.rb:36:in `initialize'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:150:in `new'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:150:in `http_api'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:96:in `create'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:87:in `create_or_update'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:58:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:619:in `register'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:264:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:445:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:424:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:60:in `load'
C:/opscode/chef/bin/chef-client:60:in `<main>'
[2016-04-06T16:57:39-07:00] ERROR: Running exception handlers
[2016-04-06T16:57:39-07:00] ERROR: Exception handlers complete
[2016-04-06T16:57:39-07:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
[2016-04-06T16:57:39-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-04-06T16:57:39-07:00] DEBUG: Chef::Exceptions::PrivateKeyMissing: I cannot read C:\chef\validation.pem, which you told me to use to sign requests!
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http/authenticator.rb:86:in `rescue in load_signing_key'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http/authenticator.rb:76:in `load_signing_key'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http/authenticator.rb:40:in `initialize'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http.rb:93:in `new'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http.rb:93:in `block in initialize'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http.rb:92:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/http.rb:92:in `initialize'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/server_api.rb:36:in `initialize'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:150:in `new'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:150:in `http_api'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:96:in `create'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:87:in `create_or_update'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/api_client/registration.rb:58:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:619:in `register'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:264:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:445:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:424:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:60:in `load'
C:/opscode/chef/bin/chef-client:60:in `<main>'
[2016-04-06T16:57:39-07:00] FATAL: Chef::Exceptions::PrivateKeyMissing: I cannot read C:\chef\validation.pem, which you told me to use to sign requests!
这是来自我甚至使用-c
指定配置路径的运行。客户端似乎使用默认配置值,我无法确定原因。
答案 0 :(得分:2)
以下是答案:我使用Powershell中的Out-File编写client.rb文件,其默认编码为“Unicode”(http://ss64.com/ps/out-file.html)。厨师显然有问题。解决方案是以UTF8输出。