-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #251 from traylenator/coredump
Manage systemd-coredump config and setup
- Loading branch information
Showing
7 changed files
with
246 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# @api private | ||
# @summary This class manages the systemd-coredump configuration. | ||
# @see https://www.freedesktop.org/software/systemd/man/systemd-coredump.html | ||
class systemd::coredump { | ||
assert_private() | ||
|
||
$systemd::coredump_settings.each |$option, $value| { | ||
ini_setting { | ||
"coredump_${option}": | ||
path => '/etc/systemd/coredump.conf', | ||
section => 'Coredump', | ||
setting => $option, | ||
value => $value, | ||
} | ||
} | ||
|
||
systemd::dropin_file { 'coredump_backtrace.conf': | ||
ensure => bool2str($systemd::coredump_backtrace, 'file', 'absent'), | ||
unit => 'systemd-coredump@.service', | ||
content => "# Puppet\n[Service]\nExecStart=\nExecStart=-/usr/lib/systemd/systemd-coredump --backtrace\n", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'Systemd::CoredumpSettings' do | ||
it { is_expected.to allow_value({ 'Storage' => 'none' }) } | ||
|
||
it { | ||
is_expected.to allow_value( | ||
{ | ||
'Storage' => 'external', | ||
'Compress' => 'yes', | ||
'ProcessSizeMax' => '123K', | ||
'ExternalSizeMax' => '456G', | ||
'JournalSizeMax' => '45T', | ||
'MaxUse' => '1P', | ||
'MaxFree' => '1E', | ||
} | ||
) | ||
} | ||
|
||
it { | ||
is_expected.to allow_value( | ||
{ | ||
'Storage' => 'journal', | ||
'Compress' => 'no', | ||
'ProcessSizeMax' => '123', | ||
'ExternalSizeMax' => '456', | ||
'JournalSizeMax' => '45', | ||
'MaxUse' => '1', | ||
'MaxFree' => '5', | ||
} | ||
) | ||
} | ||
|
||
it { is_expected.not_to allow_value({ 'Storage' => 'big' }) } | ||
it { is_expected.not_to allow_value({ 'Compress' => 'maybe' }) } | ||
it { is_expected.not_to allow_value({ 'MaxUse' => '-10' }) } | ||
it { is_expected.not_to allow_value({ 'MaxFee' => '10Gig' }) } | ||
it { is_expected.not_to allow_value({ 'ProcessSizeMax' => '20g' }) } | ||
it { is_expected.not_to allow_value({ 'JournalSizeMax' => '20Z' }) } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# @summary Configurations for coredump.conf | ||
# @see https://www.freedesktop.org/software/systemd/man/coredump.conf.html | ||
# | ||
type Systemd::CoredumpSettings = Struct[ | ||
{ | ||
Optional['Storage'] => Enum['none', 'external', 'journal'], | ||
Optional['Compress'] => Enum['yes','no'], | ||
Optional['ProcessSizeMax'] => Pattern[/^[0-9]+(K|M|G|T|P|E)?$/], | ||
Optional['ExternalSizeMax'] => Pattern[/^[0-9]+(K|M|G|T|P|E)?$/], | ||
Optional['JournalSizeMax'] => Pattern[/^[0-9]+(K|M|G|T|P|E)?$/], | ||
Optional['MaxUse'] => Pattern[/^[0-9]+(K|M|G|T|P|E)?$/], | ||
Optional['MaxFree'] => Pattern[/^[0-9]+(K|M|G|T|P|E)?$/], | ||
} | ||
] |