Chef

廚師客戶從 2 天前開始停止工作

  • August 19, 2014

我在部署新的 Windows 節點時遇到了一些麻煩。廚師客戶端因此錯誤而失敗

我想解決這個問題,但我不知道找到可以幫助我解決這個問題的錯誤。

謝謝!!!

c:/chef/cache/chef-stacktrace.out 的 Stacktrace 輸出:

Generated at 2014-05-09 10:37:19 +0000
EOFError: end of file reached
C:/opscode/chef/embedded/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock'
C:/opscode/chef/embedded/lib/ruby/1.9.1/openssl/buffering.rb:174:in `read_nonblock'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:1294:in `request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:1287:in `block in request'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:746:in `start'
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:1285:in `request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/http/basic_client.rb:65:in `request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/http.rb:257:in `block in send_http_request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/http.rb:289:in `retrying_http_errors'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/http.rb:251:in `send_http_request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/http.rb:141:in `request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/rest.rb:115:in `get'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/node.rb:507:in `load'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/node.rb:491:in `find_or_create'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/policy_builder/expand_node_object.rb:92:in `load_node'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/client.rb:249:in `load_node'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/client.rb:418:in `do_run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/client.rb:227:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/application.rb:217:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/application/client.rb:328:in `block in run_application'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/application/client.rb:317:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/application/client.rb:317:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/lib/chef/application.rb:67:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4-x86-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:23:in `load'
C:/opscode/chef/bin/chef-client:23:in `<main>

這是我的廚師客戶輸出。

PS C:\Users\Administrator> chef-client
[2014-05-09T10:42:42+00:00] WARN:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.

To fix this issue add an entry like this to your configuration file:

Verify all HTTPS connections (recommended)

ssl_verify_mode :verify_peer

OR, Verify only connections to chef-server

verify_api_cert true


To check your SSL configuration, or troubleshoot errors, you can use the
`knife ssl check` command like so:

knife ssl check -c C:\chef\client.rb


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Starting Chef Client, version 11.12.4
[2014-05-09T10:42:45+00:00] INFO: *** Chef 11.12.4 ***
[2014-05-09T10:42:45+00:00] INFO: Chef-client pid: 1048

================================================================================
Chef encountered an error attempting to load the node data for "mynode"
================================================================================

Unexpected Error:
-----------------
EOFError: end of file reached

[2014-05-09T10:42:54+00:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 11.232079 seconds
[2014-05-09T10:42:54+00:00] FATAL: EOFError: end of file reached
PS C:\Users\Administrator>

這是刀架空間創建伺服器輸出的輸出:

localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 1" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 2" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 3" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 4" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 5" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 6" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 7" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 8" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 9" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 10" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 11" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 12" 
localhost "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7917-1399629922.bat" chunk 13" 
localhost Checking for existing directory "C:\chef"...
localhost Existing directory not found, creating.
localhost 
localhost C:\Users\Administrator>(
localhost echo.url = WScript.Arguments.Named("url")  
localhost  echo.path = WScript.Arguments.Named("path")  
localhost  echo.proxy = null  
localhost  echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")  
localhost  echo.Set wshShell = CreateObject( "WScript.Shell" )  
localhost  echo.Set objUserVariables = wshShell.Environment("USER")  
localhost  echo. 
localhost  echo.rem http proxy is optional  
localhost  echo.rem attempt to read from HTTP_PROXY env var first  
localhost  echo.On Error Resume Next  
localhost  echo. 
localhost  echo.If NOT (objUserVariables("HTTP_PROXY") = "") Then  
localhost  echo.proxy = objUserVariables("HTTP_PROXY")  
localhost  echo. 
localhost  echo.rem fall back to named arg  
localhost  echo.ElseIf NOT (WScript.Arguments.Named("proxy") = "") Then  
localhost  echo.proxy = WScript.Arguments.Named("proxy")  
localhost  echo.End If  
localhost  echo. 
localhost  echo.If NOT isNull(proxy) Then  
localhost  echo.rem setProxy method is only available on ServerXMLHTTP 6.0+  
localhost  echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")  
localhost  echo.objXMLHTTP.setProxy 2, proxy  
localhost  echo.End If  
localhost  echo. 
localhost  echo.On Error Goto 0  
localhost  echo. 
localhost  echo.objXMLHTTP.open "GET", url, false  
localhost  echo.objXMLHTTP.send() 
localhost  echo.If objXMLHTTP.Status = 200 Then  
localhost  echo.Set objADOStream = CreateObject("ADODB.Stream")  
localhost  echo.objADOStream.Open 
localhost  echo.objADOStream.Type = 1  
localhost  echo.objADOStream.Write objXMLHTTP.ResponseBody  
localhost  echo.objADOStream.Position = 0  
localhost  echo.Set objFSO = Createobject("Scripting.FileSystemObject")  
localhost  echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path  
localhost  echo.Set objFSO = Nothing  
localhost  echo.objADOStream.SaveToFile path  
localhost  echo.objADOStream.Close 
localhost  echo.Set objADOStream = Nothing  
localhost  echo.End if  
localhost  echo.Set objXMLHTTP = Nothing 
localhost ) 1>C:\chef\wget.vbs 
localhost 
localhost C:\Users\Administrator>(
localhost echo.param( 
localhost  echo.   [String] $remoteUrl,  
localhost  echo.   [String] $localPath  
localhost  echo.) 
localhost  echo. 
localhost  echo.$webClient = new-object System.Net.WebClient;  
localhost  echo. 
localhost  echo.$webClient.DownloadFile($remoteUrl, $localPath); 
localhost ) 1>C:\chef\wget.ps1 
localhost 
localhost C:\Users\Administrator>(
localhost  
localhost   
localhost  
localhost ) 
localhost Detected Windows Version 6.2 Build 9200
localhost 
localhost C:\Users\Administrator>goto Version6.2 
localhost 
localhost C:\Users\Administrator>goto architecture_select 
localhost 
localhost C:\Users\Administrator>goto Architecture 
localhost 
localhost C:\Users\Administrator>goto ArchitectureAMD64 
localhost 
localhost C:\Users\Administrator>goto install 
localhost Checking for existing downloaded package at "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"
localhost No existing downloaded packages to delete.
localhost Attempting to download client package using cscript...
localhost 
localhost C:\Users\Administrator>cscript /nologo C:\chef\wget.vbs /url:"https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86_64&v=" /path:"C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi" 
localhost Download via cscript succeeded.
localhost Installing downloaded client package...
localhost 
localhost C:\Users\Administrator>msiexec /qn /log "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-msi23498.log" /i "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi" 
localhost Installation completed successfully
localhost Writing validation key...
localhost Validation key written.
localhost 
localhost C:\Users\Administrator>mkdir C:\chef\ohai\hints 
localhost 
localhost C:\Users\Administrator>(echo.{}) 1>C:\chef\ohai\hints\rackspace.json 
localhost 
localhost C:\Users\Administrator>(
localhost echo.log_level        :info  
localhost  echo.log_location     STDOUT  
localhost  echo. 
localhost  echo.chef_server_url  "https://chef.server.net"  
localhost  echo.validation_client_name "chef-validator"  
localhost  echo.client_key        "c:/chef/client.pem"  
localhost  echo.validation_key    "c:/chef/validation.pem"  
localhost  echo. 
localhost  echo.file_cache_path   "c:/chef/cache"  
localhost  echo.file_backup_path  "c:/chef/backup"  
localhost  echo.cache_options     ({:path => "c:/chef/cache/checksums", :skip_expires => true})  
localhost  echo. 
localhost  echo.node_name "mynode" 
localhost ) 1>C:\chef\client.rb 
localhost 
localhost C:\Users\Administrator>(echo.{"run_list":["role[windows]"]}) 1>C:\chef\first-boot.json 
localhost Starting chef to bootstrap the node...
localhost 
localhost C:\Users\Administrator>SET "PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin" 
localhost 
localhost C:\Users\Administrator>chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json -E _default 
localhost [2014-05-09T10:06:37+00:00] WARN: 
localhost * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
localhost SSL validation of HTTPS requests is disabled. HTTPS connections are still
localhost encrypted, but chef is not able to detect forged replies or man in the middle
localhost attacks.
localhost 
localhost To fix this issue add an entry like this to your configuration file:
localhost 
localhost ```
localhost   # Verify all HTTPS connections (recommended)
localhost   ssl_verify_mode :verify_peer
localhost 
localhost   # OR, Verify only connections to chef-server
localhost   verify_api_cert true
localhost ```
localhost 
localhost To check your SSL configuration, or troubleshoot errors, you can use the
localhost `knife ssl check` command like so:
localhost 
localhost ```
localhost   knife ssl check -c c:/chef/client.rb
localhost ```
localhost 
localhost * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
localhost 
localhost [2014-05-09T10:06:39+00:00] INFO: *** Chef 11.12.4 ***
localhost [2014-05-09T10:06:39+00:00] INFO: Chef-client pid: 1408
localhost [2014-05-09T10:07:14+00:00] INFO: Client key c:/chef/client.pem is not present - registering
localhost [2014-05-09T10:07:15+00:00] INFO: HTTP Request Returned 404 Object Not Found: error
localhost [2014-05-09T10:07:15+00:00] INFO: Setting the run_list to ["role[windows]"] from CLI options
localhost [2014-05-09T10:07:15+00:00] INFO: Run List is [role[windows]]
localhost [2014-05-09T10:07:15+00:00] INFO: Run List expands to [newrelic::server-monitor-agent, ms_dotnet45, powershell]
localhost [2014-05-09T10:07:15+00:00] INFO: Starting Chef Run for mynode
localhost [2014-05-09T10:07:15+00:00] INFO: Running start handlers
localhost [2014-05-09T10:07:15+00:00] INFO: Start handlers complete.
localhost [2014-05-09T10:07:15+00:00] INFO: HTTP Request Returned 404 Object Not Found: 
localhost 
localhost ================================================================================
localhost Error Resolving Cookbooks for Run List:
localhost ================================================================================
localhost 
localhost Unexpected Error:
localhost -----------------
localhost EOFError: end of file reached
localhost 
localhost [2014-05-09T10:07:15+00:00] ERROR: Running exception handlers
localhost [2014-05-09T10:07:15+00:00] ERROR: Exception handlers complete
localhost [2014-05-09T10:07:15+00:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
localhost [2014-05-09T10:07:15+00:00] FATAL: EOFError: end of file reached

跟著這些步驟:

1-從您的廚師伺服器中刪除該節點的節點和客戶端。

2-使用工作站中的引導程序重新安裝廚師客戶端

knife bootstrap windows winrm server_ip -x Administrator -P server_pass -N server_name

不要添加任何角色,只需從命令提示符執行以檢查其是否正常工作:

頭客戶

廚師客戶端在該文件中配置其名為 client.rb 的文件,您必須具有以下行:

節點名稱“伺服器名稱”

這應該可以工作,因為您遇到的問題與我幾週前遇到的問題完全相同。這是因為 OHAI 瘋狂地拉取節點名稱。

引用自:https://serverfault.com/questions/594111