Skip to content

Commit

Permalink
Merge pull request #356 from traylenator/LogLevelMax
Browse files Browse the repository at this point in the history
Allow LogLevelMax to be set in [Service]
  • Loading branch information
traylenator committed Jun 25, 2023
2 parents 2ec2656 + d379fee commit 4b01a51
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,18 @@ systemd::manage_dropin { 'corelimit.conf':
}
```

##### make a noisy unit less noisy

```puppet
systemd::manage_dropin { 'maxloglevel.conf':
ensure => present,
unit => 'chatty.service',
service_entry => {
'LogLevelMax' => 'warning',
}
}
```

#### Parameters

The following parameters are available in the `systemd::manage_dropin` defined type:
Expand Down Expand Up @@ -2334,6 +2346,7 @@ Struct[{
Optional['KillSignal'] => Pattern[/^SIG[A-Z]+$/],
Optional['KillMode'] => Enum['control-group', 'mixed', 'process', 'none'],
Optional['SyslogIdentifier'] => String,
Optional['LogLevelMax'] => Enum['emerg','alert','crit','err','warning','notice','info','debug'],
Optional['LimitCORE'] => Pattern['^(infinity|((\d+(K|M|G|T|P|E)?(:\d+(K|M|G|T|P|E)?)?)))$'],
Optional['RestartSec'] => String,
Optional['TimeoutStartSec'] => String,
Expand Down
9 changes: 9 additions & 0 deletions manifests/manage_dropin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
# },
# }
#
# @example make a noisy unit less noisy
# systemd::manage_dropin { 'maxloglevel.conf':
# ensure => present,
# unit => 'chatty.service',
# service_entry => {
# 'LogLevelMax' => 'warning',
# }
# }
#
# @param unit The unit to create a dropfile for
# @param filename The target unit file to create. The filename of the drop in. The full path is determined using the path, unit and this filename.
# @param ensure The state of this dropin file
Expand Down
3 changes: 3 additions & 0 deletions spec/type_aliases/systemd_unit_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@
it { is_expected.to allow_value({ 'WorkingDirectory' => '-/var/lib/here' }) }
it { is_expected.to allow_value({ 'WorkingDirectory' => '~' }) }
it { is_expected.to allow_value({ 'WorkingDirectory' => '' }) }

it { is_expected.to allow_value({ 'LogLevelMax' => 'alert' }) }
it { is_expected.not_to allow_value({ 'LogLevelMax' => 'top' }) }
end
1 change: 1 addition & 0 deletions types/unit/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Optional['KillSignal'] => Pattern[/^SIG[A-Z]+$/],
Optional['KillMode'] => Enum['control-group', 'mixed', 'process', 'none'],
Optional['SyslogIdentifier'] => String,
Optional['LogLevelMax'] => Enum['emerg','alert','crit','err','warning','notice','info','debug'],
Optional['LimitCORE'] => Pattern['^(infinity|((\d+(K|M|G|T|P|E)?(:\d+(K|M|G|T|P|E)?)?)))$'],
Optional['RestartSec'] => String,
Optional['TimeoutStartSec'] => String,
Expand Down

0 comments on commit 4b01a51

Please sign in to comment.