Mein Kochbuch erfordert, dass der Gast nach der Installation von WMF5 auf Windows Server 2012 R2 neu gestartet wird.Testküche wird nicht wiederholt, wenn Neustart in Server 2012R2 verwendet wird
reboot 'Reboot Windows' do
action :nothing
end
chocolatey 'DotNet4.5.1' do
version '4.5.1.20140606'
action :install
end
chocolatey 'Powershell' do
version '5.0.10586.20161027'
action :install
options ({ '-ignore-package-exit-codes' => '' })
end
powershell_script 'Reboot if PowerShell v4' do
notifies :reboot_now, 'reboot[Reboot Windows]', :immediately
only_if { reboot_pending? }
end
Wenn der Neustart erfolgt, wird die Testküchenausgabe beendet, ohne erneut zu konvergieren. Ich kann auch keinen Exit-Code sehen.
D [WinRM] Waiting for output...
D [WinRM] Processing output
- execute the ruby block track-path-Powershell
* powershell_script[Reboot if PowerShell v4] 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-script20161212-936-452h54.ps1"
* reboot[Reboot Windows] action reboot_now[2016-12-12T15:44:04-05:00] WARN: Rebooting system immediately, requested by 'Reboot Windows'
Running handlers:
Running handlers complete
Chef Client finished, 54/140 resources updated in 02 minutes 46 seconds
[2016-12-12T15:44:04-05:00] WARN: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2016-12-12 15:44:04 -0500, :requested_by=>"Reboot Windows"}
D [WinRM] Waiting for output...
D [WinRM] Processing output
D [WinRM] cleaning up command_id: 737D4041-AE48-4403-ADEC-840D31B1FE0E on shell_id B4370D6D-AE03-46E3-9823-EFB3EF2EA14C
$$$$$$ DL is deprecated, please use Fiddle
D Cleaning up local sandbox in C:/Users/lsmit648/AppData/Local/Temp/default-windows2012r2min-sandbox-20161212-12432-rf5u0f
Finished converging <default-windows2012r2min> (3m19.06s).
-----> Kitchen is finished. (3m58.02s)
Hier ist meine .kitchen.yaml Datei
---
driver:
name: vagrant
provider: virtualbox
gui: false
box_check_update: true
vm_hostname: false
communicator: winrm
guest: windows
customize:
natdnshostresolver1: 'on'
natdnsproxy1: 'on'
usb: 'off'
reset_command: "exit 0"
username: 'vagrant'
password: 'vagrant'
winrm:
boot_timeout: 600
max_tries: 500
# https://github.com/chef/chef-dk/issues/1009#issuecomment-246875683
transport:
name: winrm
username: 'vagrant'
password: 'vagrant'
elevated: true
provisioner:
name: chef_zero
retry_on_exit_code:
- [35, 1]
max_retries: 5
wait_for_retry: 60
client_rb:
exit_status: :enabled
verifier:
name: inspec
platforms:
- name: windows2012.r2.min
transport:
port: 5985
os_type: windows
shell_type: powershell
driver:
box: windows2012.r2.min
box_url: <%= ENV['VAGRANT_BOX_REPOSITORY'] %>/windows2012.r2min.json
port: 5985
winrm:
guest_port: 5985
network:
- ['forwarded_port', {guest: 3389, host: 9561, id: 'rdp', auto_correct: true}]
- ['forwarded_port', {guest: 5985, host: 9571, id: 'winrm', auto_correct: true}]
suites:
- name: default
run_list:
- recipe[chocolatey::default]
- recipe[wmf_5]
- recipe[roles_features]
Wie kann ich den Exit-Code erfassen, dass Neustart, um mit Küchen versucht zu haben, wieder zu laufen?