Open spuder opened 8 years ago
10.x.x.x [2016-12-14T18:24:02+00:00] WARN: Per RFC 062 (https://github.com/chef/chef-rfc/blob/master/rfc062-exit-status.md), when a reboot is requested Chef Client will exit with an exit code of 35, REBOOT_SCHEDULED.
To maintain the current behavior (an exit code of 0), you will need to set `exit_status` to `:disabled` in your client.rb (CHEF-2)C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/bin/chef-client:26:in `<top (required)>
This causes an error exit code in chef 13
Converging 1 resources
Recipe: nd-ad-join::default
* domain_join[default] action join
* reboot[Restart Computer] action nothing (skipped due to action :nothing)
* registry_key[warning] action nothing (skipped due to action :nothing)
* windows_task[chef ad-join] action create
* registry_key[warning] action create (skipped due to only_if)
* powershell_script[ad-join] action run
- execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20170419-2296-jd08h1.ps1"
* reboot[Restart Computer] action reboot_now[2017-04-19T16:41:53+00:00] WARN: Rebooting system immediately, requested by 'Restart Computer'
Running handlers:
Running handlers complete
Chef Client finished, 2/5 resources updated in 58 seconds
[2017-04-19T16:41:54+00:00] WARN: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2017-04-19 16:41:53 +0000, :requested_by=>"Restart Computer"}
Running handlers:
[2017-04-19T16:41:54+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-04-19T16:41:54+00:00] ERROR: Exception handlers complete
Chef Client failed. 2 resources updated in 58 seconds
[2017-04-19T16:41:54+00:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2017-04-19T16:41:54+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-04-19T16:41:54+00:00] FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2017-04-19 16:41:53 +0000, :requested_by=>"Restart Computer"}
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Converge failed on instance <default-netdocuments-windows-2012r2>. Please see .kitchen/logs/default-netdocuments-windows-2012r2.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
Work arounds
chef-client --config-option exit_status :disabled
exit_status :disabled
to client.rbUnfortunately this still returns an exit code of -35
on bootstrap. While possible to work around that with bootstrap templates, that is too much of a burden to users just wanting to use this custom resource. No other options until opscode makes this more friendly.
On chef 13.6.4 the chef run succeeds as far as powershell is concerned, but still reports an error to the chef server
10.254.130.131 ------------ ------------
10.254.130.131 True WIN-CAAS59QUOG5
10.254.130.131 [2018-02-20T23:27:46+00:00] INFO: powershell_script[ad-join] ran successfully
10.254.130.131 - execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20180220-3096-1xfva8n.ps1"
10.254.130.131 [2018-02-20T23:27:46+00:00] INFO: powershell_script[ad-join] sending reboot_now action to reboot[Restart Computer] (immediate)
10.254.130.131 * reboot[Restart Computer] action reboot_now[2018-02-20T23:27:46+00:00] INFO: Processing reboot[Restart Computer] action reboot_now (c:/chef/cache/cookbooks/ad-join/resources/domain_join_windows.rb line 45)
10.254.130.131 [2018-02-20T23:27:46+00:00] WARN: Rebooting system immediately, requested by 'Restart Computer'
10.254.130.131 [2018-02-20T23:27:46+00:00] INFO: Changing reboot status from {} to {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2018-02-20 23:27:46 +0000, :requested_by=>"Restart Computer"}
10.254.130.131 [2018-02-20T23:27:46+00:00] INFO: Chef Run complete in 90.076784 seconds
10.254.130.131
10.254.130.131
10.254.130.131 Running handlers:
10.254.130.131 [2018-02-20T23:27:46+00:00] INFO: Running report handlers
10.254.130.131 - Chef::Handler::Slack
10.254.130.131 Running handlers complete
10.254.130.131 [2018-02-20T23:27:46+00:00] INFO: Report handlers complete
10.254.130.131 Chef Client finished, 10/13 resources updated in 02 minutes 08 seconds
10.254.130.131 [2018-02-20T23:27:46+00:00] INFO: Sending resource update report (run-id: a7db9f12-996e-48a1-88c8-89420eec731d)
10.254.130.131 [2018-02-20T23:27:46+00:00] WARN: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2018-02-20 23:27:46 +0000, :requested_by=>"Restart Computer"}
10.254.130.131
10.254.130.131
10.254.130.131 Running handlers:
10.254.130.131 [2018-02-20T23:27:46+00:00] ERROR: Running exception handlers
10.254.130.131 - Chef::Handler::Slack
10.254.130.131 Running handlers complete
10.254.130.131 [2018-02-20T23:27:46+00:00] ERROR: Exception handlers complete
10.254.130.131 Chef Client failed. 10 resources updated in 02 minutes 08 seconds
10.254.130.131 [2018-02-20T23:27:46+00:00] INFO: Sending resource update report (run-id: a7db9f12-996e-48a1-88c8-89420eec731d)
10.254.130.131 [2018-02-20T23:27:47+00:00] INFO: HTTP Request Returned 404 Object Not Found:
10.254.130.131 [2018-02-20T23:27:47+00:00] ERROR: Failed to post reporting data to server (HTTP 404), saving to c:/chef/cache/failed-reporting-data.json
10.254.130.131 [2018-02-20T23:27:47+00:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
10.254.130.131 [2018-02-20T23:27:47+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
10.254.130.131 [2018-02-20T23:27:47+00:00] FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2018-02-20 23:27:46 +0000, :requested_by=>"Restart Computer"}
ERROR: WinRM::WinRMWSManFault: [WSMAN ERROR CODE: 2150858843]: <f:WSManFault Code='2150858843' Machine='10.254.130.131' xmlns:f='http://schemas.microsoft.com/wbem/wsman/1/wsmanfault'><f:Message>The request for the Windows Remote Shell with ShellId 21D7ABF2-AB1F-49CB-94B9-AA3E7FC4E082 failed because the shell was not found on the server. Possible causes are: the specified ShellId is incorrect or the shell no longer exists on the server. Provide the correct ShellId or create a new shell and retry the operation. </f:Message></f:WSManFault>
spencer-demo1 Provisioning Complete
FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's
The way chef handles reboots is changing.
https://github.com/chef/chef-rfc/blob/master/rfc062-exit-status.md
Make sure cookbook supports non 0 exit codes