Skip to content

Commit 1286a8f

Browse files
committed
Add syslog_facility parameter to docker::run
It is useful to be able to control the facility of log messages, so that it can be handled by syslog appropriately
1 parent 84de2a5 commit 1286a8f

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

manifests/run.pp

+3
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@
187187
#
188188
# @param syslog_identifier
189189
#
190+
# @param syslog_facility
191+
#
190192
# @param read_only
191193
#
192194
define docker::run(
@@ -244,6 +246,7 @@
244246
Optional[Boolean] $remove_volume_on_stop = false,
245247
Optional[Integer] $stop_wait_time = 0,
246248
Optional[String] $syslog_identifier = undef,
249+
Optional[String] $syslog_facility = undef,
247250
Optional[Boolean] $read_only = false,
248251
Optional[String] $health_check_cmd = undef,
249252
Optional[Boolean] $restart_on_unhealthy = false,

spec/defines/run_spec.rb

+3
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@
197197
'docker_service' => 'my-docker',
198198
'restart_service_on_docker_refresh' => false,
199199
},
200+
'when passing syslog_facility' => {
201+
'syslog_facility' => 'user',
202+
},
200203
}
201204

202205
describe 'docker::run', type: :define do

templates/etc/systemd/system/docker-run.erb

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Environment="HOME=/root"
3232
<%- if @_syslog_identifier -%>
3333
SyslogIdentifier=<%= @_syslog_identifier %>
3434
<%- end -%>
35+
<%- if @syslog_facility -%>
36+
SyslogFacility=<%= @syslog_facility %>
37+
<%- end -%>
3538
ExecStart=/usr/local/bin/docker-run-<%= @sanitised_title %>-start.sh
3639
ExecStop=-/usr/local/bin/docker-run-<%= @sanitised_title %>-stop.sh
3740
<%- if @remain_after_exit %>

0 commit comments

Comments
 (0)