Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for RemainAfterExit #549

Merged
merged 2 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manifests/run.pp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
# (optional) Specifies the command to execute after container is created but before it is started.
# Default: undef
#
# [*remain_after_exit*]
# (optional) If the container is to be managed by a systemd unit file set the
# RemainAfterExit option on the unit file. Can be any valid value for this systemd
# configuration.
# Default: Not included in unit file
#
define docker::run(
Optional[Pattern[/^[\S]*$/]] $image,
Optional[Pattern[/^present$|^absent$/]] $ensure = 'present',
Expand Down Expand Up @@ -143,6 +149,7 @@
Optional[Boolean] $restart_on_unhealthy = false,
Optional[Integer] $health_check_interval = undef,
Variant[String,Array,Undef] $custom_unless = [],
Optional[String] $remain_after_exit = undef,
) {
include docker::params
if ($socket_connect != []) {
Expand Down
3 changes: 3 additions & 0 deletions templates/etc/systemd/system/docker-run.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ SyslogIdentifier=<%= @_syslog_identifier %>
<%- end -%>
ExecStart=/usr/local/bin/docker-run-<%= @sanitised_title %>-start.sh
ExecStop=-/usr/local/bin/docker-run-<%= @sanitised_title %>-stop.sh
<%- if @remain_after_exit %>
RemainAfterExit=<%= @remain_after_exit %>
<%- end -%>

[Install]
WantedBy=multi-user.target