【问题标题】:Test Kitchen: Chef don't restart after reboot测试厨房:重新启动后厨师不重新启动
【发布时间】:2017-03-27 21:44:18
【问题描述】:

我在使用 Kitchen 测试我的厨师食谱时遇到了问题。 我使用 Vagrant 作为驱动程序,使用 Virtual Box 作为虚拟化系统。它们在 Linux 平台上运行。

我创建了一个测试配方来重新启动我的机器。 这是代码:

#
# Author:: Alessandro Zucchelli
# Recipe:: test_recipe_required_reboot
#

reboot 'test if kitchen runs when a recipe leaves it to the post-install phase' do
  action :request_reboot
  reason 'Need to reboot when the run completes successfully.'
  delay_mins 1
end

我在这种模式下配置我的 .kitchen.yml:

driver:
  name: vagrant
  gui: true
  boot_timeout: 1200
#  log_level: debug
provisioner:
  name: chef_zero
  require_chef_omnibus: 12.11 # need the RFC 062 exit codes
  retry_on_exit_code: 
    - 35 # 35 is the exit code signaling that the node is rebooting
  max_retries: 3
  multiple_converge: 3
  client_rb:
    exit_status: :enabled # Opt-in to the standardized exit codes
    client_fork: false # Forked instances don't return the real exit code
  #log_level: debug
platforms:
  - name: mybox/win-7-professional-amd64-nocm
    transport:
        name: winrm
        elevated: true
        connection_timeout: 3600
        max_wait_until_ready: 600
        connection_retry_sleep: 300

我希望通过启动配方循环多次重启 vm。 相反,在第一次重新启动后,我得到:

      Starting Chef Client, version 12.11.18
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #converge action: [execution expired] on ktest-mybox-win-7-professional-amd64-nocm
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

【问题讨论】:

    标签: vagrant chef-infra test-kitchen convergence


    【解决方案1】:

    我解决了我的问题! 我在 kitchen.yml 中添加了这个参数(查看代码块),现在可以正常工作了!

      max_retries: 3
      multiple_converge: 3
      wait_for_retry: 600
    

    我的食谱现在重启了 4 次我的虚拟机!

    【讨论】:

      猜你喜欢
      • 2014-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-29
      • 2015-10-28
      相关资源
      最近更新 更多