Skip to content

Commit d6ea774

Browse files
committed
Fix container running check to work for windows hosts
1 parent 043395e commit d6ea774

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

manifests/run.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
if $running == false {
312312
exec { "stop ${title} with docker":
313313
command => "${docker_command} stop --time=${stop_wait_time} ${sanitised_title}",
314-
unless => "${docker_command} inspect ${sanitised_title} -f \"{{ .State.Running }}\" | grep true",
314+
unless => "${docker_command} inspect ${sanitised_title} -f \"{{ if (.State.Running) }} {{ nil }}{{ end }}\"",
315315
environment => $exec_environment,
316316
path => $exec_path,
317317
provider => $exec_provider,
@@ -320,7 +320,7 @@
320320
} else {
321321
exec { "start ${title} with docker":
322322
command => "${docker_command} start ${sanitised_title}",
323-
onlyif => "${docker_command} inspect ${sanitised_title} -f \"{{ .State.Running }}\" | grep false",
323+
onlyif => "${docker_command} inspect ${sanitised_title} -f \"{{ if (.State.Running) }} {{ nil }}{{ end }}\"",
324324
environment => $exec_environment,
325325
path => $exec_path,
326326
provider => $exec_provider,

0 commit comments

Comments
 (0)