2017-03-27 157 views
0

我在使用廚房測試廚師食譜期間出現問題。 我將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 

我希望通過啓動配方走循環重啓虛擬機不止一次。 相反,第一次重新啓動後,我得到:

 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 

回答

0

我解決我的問題! 我在kitchen.yml中添加了這個參數(視圖代碼塊),現在可以正常工作!

max_retries: 3 
    multiple_converge: 3 
    wait_for_retry: 600 

我的食譜現在重新啓動4次我的虛擬機!

相關問題