Skip to content

Commit 1d68a0e

Browse files
authored
Merge pull request #271 from mihaibuzgau/healthcheck_windows
fix for restart_check on windows
2 parents 99e0a28 + 73aad53 commit 1d68a0e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

manifests/run.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@
211211
}
212212

213213
if $::osfamily == 'windows' {
214-
$exec_environment = 'PATH=C:/Program Files/Docker/'
214+
$exec_environment = 'PATH=C:/Program Files/Docker/;C:/Windows/System32/'
215215
$exec_timeout = 3000
216216
$exec_path = ['c:/Windows/Temp/', 'C:/Program Files/Docker/']
217217
$exec_provider = 'powershell'
218218
$cidfile = "c:/Windows/Temp/${service_prefix}${sanitised_title}.cid"
219-
$restart_check = "${docker_command} inspect ${sanitised_title} -f '{{ if eq \"unhealthy\" .State.Health.Status }} {{ .Name }}{{ end }}' | findstr ${sanitised_title}"
219+
$restart_check = "${docker_command} inspect ${sanitised_title} -f '{{ if eq \\\"unhealthy\\\" .State.Health.Status }} {{ .Name }}{{ end }}' | findstr ${sanitised_title}"
220220
} else {
221221
$exec_environment = 'HOME=/root'
222222
$exec_path = ['/bin', '/usr/bin']

spec/acceptance/docker_full_spec.rb

+10-5
Original file line numberDiff line numberDiff line change
@@ -754,16 +754,21 @@ class { 'docker': #{docker_ee_arg} }
754754
it 'should restart a unhealthy container' do
755755
pp5=<<-EOS
756756
docker::run { 'container_3_7_3':
757-
image => 'base',
757+
image => '#{default_image}',
758758
command => '#{default_run_command}',
759-
health_check_cmd => 'pwd',
759+
health_check_cmd => 'echo',
760760
restart_on_unhealthy => true,
761+
#{default_docker_run_arg}
761762
}
762763
EOS
763764

764-
apply_manifest(pp5, :catch_failures => true) do |r|
765-
expect(r.stdout).to match(/docker-container_3_7_3-systemd-reload/)
766-
end
765+
if fact('osfamily') == 'windows'
766+
apply_manifest(pp5, :catch_failures => true)
767+
else
768+
apply_manifest(pp5, :catch_failures => true) do |r|
769+
expect(r.stdout).to match(/docker-container_3_7_3-systemd-reload/)
770+
end
771+
end
767772
end
768773
end
769774

0 commit comments

Comments
 (0)