简体   繁体   English

厨师重新启动资源会导致厨师运行超时,然后Windows服务器才能在更新和恢复配方后启动备份

[英]Chef reboot resource causes chef run to time out before Windows server is able to start back up after update and resume recipe

I am trying to create a domain on a windows 2012 R2 server and it requires a reboot before the recipe can proceed: 我正在尝试在Windows 2012 R2服务器上创建域,并且需要重新启动才能继续执行配方:

reboot "reboot server" do
  reason "init::chef - continue provisioning after reboot"
  action :reboot_now
end

I receive the following error, which indicates a timeout + it occurs before I see the OS comes back to life after the update: 我收到以下错误,表示超时+它发生在我看到操作系统在更新后恢复正常之前。

Failed to complete #converge action: [WinRM::WinRMAuthorizationError] on default-windows2012r2

Does anyone out there know how to make the chef server continue to run after the OS is back up? 有人备份操作系统后,是否知道如何使Chef服务器继续运行? I hear that :restart_now is supposed to do the trick... ^^^ but as you can see, it isn't :) 我听说:restart_now应该可以解决问题... ^^^但您可以看到,它不是:)

PS this also causes windows to update... Goal: get chef to resume after the update is complete and the server is back up PS这也会导致Windows更新...目标:让厨师在更新完成且服务器已备份后恢复

Update : The server actually seems to be rebooting twice and exiting the chef run on the second reboot. 更新 :服务器实际上似乎在重新引导两次,并退出在第二次重新引导时运行的厨师。 If I remove the ONE reboot resource block that I have then it does not reboot at all (that makes no sense to me)... here is output from the chef run: 如果我删除了一个重启资源块,那么它根本就不会重启(这对我来说没有意义)...这是厨师运行的输出:

Chef Client finished, 2/25 resources updated in 19 seconds
   [2018-10-29T08:04:11-07:00] WARN: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"init::chef - continue provisioning after reboot", :timestamp=>2018-10-29 08:04:11 -0700, :requested_by=>"reboot server"}
    Running handlers:
       [2018-10-29T08:04:11-07:00] ERROR: Running exception handlers
       Running handlers complete
       [2018-10-29T08:04:11-07:00] ERROR: Exception handlers complete
       Chef Client failed. 2 resources updated in 20 seconds
       [2018-10-29T08:04:11-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
       [2018-10-29T08:04:11-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2018-10-29T08:04:11-07:00] FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"init::chef - continue provisioning after reboot", :timestamp=>2018-10-29 08:04:11 -0700, :requested_by=>"reboot server"}

^^^ that repeats twice ^^^ 重复两次的^^^

Update #2 : I even commented out every line except for the reboot block and am experiencing the same issue... this is ridiculous and I'm confident that it isn't my code that is the problem (considering that all I am using now is a reboot command). 更新#2 :我什至注释掉除了重新启动块以外的每一行,并且遇到相同的问题...这太荒谬了,我确信不是我的代码才是问题所在(考虑到我正在使用的所有内容)现在是重新启动命令)。

Update #3 : I generated an entirely new cookbook and called it "reboot"... it contains the following code: 更新#3 :我生成了一个全新的食谱,并将其称为“重新启动” ...它包含以下代码:

reboot 'app_requires_reboot' do
    action :request_reboot
    reason 'Need to reboot when the run completes successfully.'
end

And unfortunately, it too reboots the Windows server twice... Here are the logs: 不幸的是,它也两次重启了Windows服务器...这是日志:

Recipe: reboot::default
         * reboot[app_requires_reboot] action request_reboot[2018-10-29T10:21:41-07:00] WARN: Reboot requested:'app_requires_reboot'

           - request a system reboot to occur if the run succeeds

       Running handlers:
       Running handlers complete
       Chef Client finished, 1/1 resources updated in 03 seconds
       [2018-10-29T10:21:41-07:00] WARN: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Need to reboot when the run completes successfully.", :timestamp=>2018-10-29 10:21:41 -0700, :requested_by=>"app_requires_reboot"}

       Running handlers:
       [2018-10-29T10:21:41-07:00] ERROR: Running exception handlers
       Running handlers complete
       [2018-10-29T10:21:41-07:00] ERROR: Exception handlers complete
       Chef Client failed. 1 resources updated in 03 seconds
       [2018-10-29T10:21:41-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
       [2018-10-29T10:21:41-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2018-10-29T10:21:41-07:00] FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Need to reboot when the run completes successfully.", :timestamp=>2018-10-29 10:21:41 -0700, :requested_by=>"app_requires_reboot"}

seems like an issue with chef now... this is bad... who has ever successfully rebooted windows with Chef before? 似乎现在是Chef的问题...这很糟糕...谁曾经与Chef一起成功重启过Windows? and why does a single reboot block, reboot the server twice? 为什么一次重启阻止一次,两次重启服务器?

Update number 4 will be after I have thrown my computer out the window 更新编号4将在我将计算机扔出窗户之后

The issue was resolved with the following logic: 该问题已通过以下逻辑得到解决:

reboot "reboot server" do
  reason "init::chef - continue provisioning after reboot"
  action :nothing
  only_if {reboot_pending?}
end

Adding the only if statement allows the recipe to ski[p that step if the OS does not detect that there is a Windows update pending. 如果操作系统未检测到有Windows更新待处理,则添加“仅if”语句将使配方跳过该步骤。

I had forgotten that windows actually does track whether a system update/reboot is required. 我忘记了Windows确实会跟踪是否需要系统更新/重启。

As part of my poweshell_script block, I included the following: notifies :reboot_now, 'reboot[reboot server]', :immediately 作为我的poweshell_script块的一部分,我包括以下内容: notifies :reboot_now, 'reboot[reboot server]', :immediately

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM