From bb8665c7132f2aef92ec07cd8da3216e0264a570 Mon Sep 17 00:00:00 2001 From: Dave Try Date: Wed, 18 Jul 2018 17:39:47 +1000 Subject: [PATCH 1/4] fixes restarting containers with changes to run arguments --- manifests/run.pp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/manifests/run.pp b/manifests/run.pp index 1a57c5b5..ce863711 100755 --- a/manifests/run.pp +++ b/manifests/run.pp @@ -52,6 +52,10 @@ # (optional) Specifies the command to execute to check that the container is healthy using the docker health check functionality. # Default: undef # +# [*health_check_interval*] +# (optional) Specifies the interval that the health check command will execute in seconds. +# Default: 30 seconds +# # [*restart_on_unhealthy*] # (optional) Checks the health status of Docker container and if it is unhealthy the service will be restarted. # The health_check_cmd parameter must be set to true to use this functionality. @@ -121,6 +125,7 @@ Optional[Boolean] $read_only = false, Optional[String] $health_check_cmd = undef, Optional[Boolean] $restart_on_unhealthy = false, + Optional[Integer] $health_check_interval = 30, ) { include docker::params if ($socket_connect != []) { @@ -193,6 +198,7 @@ read_only => $read_only, health_check_cmd => $health_check_cmd, restart_on_unhealthy => $restart_on_unhealthy, + health_check_interval => $health_check_interval, }) $sanitised_title = regsubst($title, '[^0-9A-Za-z.\-_]', '-', 'G') @@ -449,14 +455,14 @@ path => ['/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/'], command => 'systemctl daemon-reload', refreshonly => true, - require => File[$initscript], - subscribe => File[$initscript], + require => [File[$initscript],File[$runscript]], + subscribe => [File[$initscript],File[$runscript]] } Exec["docker-${sanitised_title}-systemd-reload"] -> Service<| title == "${service_prefix}${sanitised_title}" |> } if $restart_service { - File[$initscript] ~> Service<| title == "${service_prefix}${sanitised_title}" |> + [File[$initscript],File[$runscript]] ~> Service<| title == "${service_prefix}${sanitised_title}" |> } else { File[$initscript] -> Service<| title == "${service_prefix}${sanitised_title}" |> From a3ab86f580277bb560069b132bb8e978b5dd0947 Mon Sep 17 00:00:00 2001 From: Dave Try Date: Wed, 18 Jul 2018 17:45:18 +1000 Subject: [PATCH 2/4] removing incorrect changes --- manifests/run.pp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/manifests/run.pp b/manifests/run.pp index ce863711..fdcbaf58 100755 --- a/manifests/run.pp +++ b/manifests/run.pp @@ -52,10 +52,6 @@ # (optional) Specifies the command to execute to check that the container is healthy using the docker health check functionality. # Default: undef # -# [*health_check_interval*] -# (optional) Specifies the interval that the health check command will execute in seconds. -# Default: 30 seconds -# # [*restart_on_unhealthy*] # (optional) Checks the health status of Docker container and if it is unhealthy the service will be restarted. # The health_check_cmd parameter must be set to true to use this functionality. @@ -125,7 +121,6 @@ Optional[Boolean] $read_only = false, Optional[String] $health_check_cmd = undef, Optional[Boolean] $restart_on_unhealthy = false, - Optional[Integer] $health_check_interval = 30, ) { include docker::params if ($socket_connect != []) { @@ -198,7 +193,6 @@ read_only => $read_only, health_check_cmd => $health_check_cmd, restart_on_unhealthy => $restart_on_unhealthy, - health_check_interval => $health_check_interval, }) $sanitised_title = regsubst($title, '[^0-9A-Za-z.\-_]', '-', 'G') From 15b232e55cd5984cf329f46b3873f8003563bb96 Mon Sep 17 00:00:00 2001 From: Dave Try Date: Wed, 18 Jul 2018 17:52:46 +1000 Subject: [PATCH 3/4] adding in for non restart_service also --- manifests/run.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/run.pp b/manifests/run.pp index fdcbaf58..80b495e8 100755 --- a/manifests/run.pp +++ b/manifests/run.pp @@ -459,7 +459,7 @@ [File[$initscript],File[$runscript]] ~> Service<| title == "${service_prefix}${sanitised_title}" |> } else { - File[$initscript] -> Service<| title == "${service_prefix}${sanitised_title}" |> + [File[$initscript],File[$runscript]] -> Service<| title == "${service_prefix}${sanitised_title}" |> } } } From 21abd8e67c454b6cc85f4bcb2cfe4418d90a88cb Mon Sep 17 00:00:00 2001 From: Dave Try Date: Wed, 18 Jul 2018 18:04:27 +1000 Subject: [PATCH 4/4] fixing lint error --- manifests/run.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/run.pp b/manifests/run.pp index 80b495e8..da583706 100755 --- a/manifests/run.pp +++ b/manifests/run.pp @@ -459,7 +459,7 @@ [File[$initscript],File[$runscript]] ~> Service<| title == "${service_prefix}${sanitised_title}" |> } else { - [File[$initscript],File[$runscript]] -> Service<| title == "${service_prefix}${sanitised_title}" |> + [File[$initscript],File[$runscript]] -> Service<| title == "${service_prefix}${sanitised_title}" |> } } }