File Coverage

blib/lib/Config/Model/models/Systemd/Section/ServiceUnit.pl
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             #
2             # This file is part of Config-Model-Systemd
3             #
4             # This software is Copyright (c) 2008-2022 by Dominique Dumont.
5             #
6             # This is free software, licensed under:
7             #
8             # The GNU Lesser General Public License, Version 2.1, February 1999
9             #
10 4     4   66118 use strict;
  4     1   9  
  4     1   129  
  1         16041  
  1         1  
  1         19  
  1         20406  
  1         3  
  1         24  
11 4     4   20 use warnings;
  4     1   9  
  4     1   683  
  1         4  
  1         2  
  1         159  
  1         5  
  1         2  
  1         240  
12              
13             return [
14             {
15             'accept' => [
16             '.*',
17             {
18             'type' => 'leaf',
19             'value_type' => 'uniline',
20             'warn' => '$unknown_param_msg'
21             }
22             ],
23             'element' => [
24             'FailureAction',
25             {
26             'choice' => [
27             'none',
28             'reboot',
29             'reboot-force',
30             'reboot-immediate',
31             'poweroff',
32             'poweroff-force',
33             'poweroff-immediate',
34             'exit',
35             'exit-force'
36             ],
37             'description' => 'Configure the action to take when the unit stops and enters a failed state or inactive state.
38             Takes one of C<none>, C<reboot>, C<reboot-force>,
39             C<reboot-immediate>, C<poweroff>, C<poweroff-force>,
40             C<poweroff-immediate>, C<exit>, and C<exit-force>. In system mode,
41             all options are allowed. In user mode, only C<none>, C<exit>, and
42             C<exit-force> are allowed. Both options default to C<none>.
43              
44             If C<none> is set, no action will be triggered. C<reboot> causes a reboot
45             following the normal shutdown procedure (i.e. equivalent to systemctl reboot).
46             C<reboot-force> causes a forced reboot which will terminate all processes forcibly but should
47             cause no dirty file systems on reboot (i.e. equivalent to systemctl reboot -f) and
48             C<reboot-immediate> causes immediate execution of the
49             L<reboot(2)> system call, which
50             might result in data loss (i.e. equivalent to systemctl reboot -ff). Similarly,
51             C<poweroff>, C<poweroff-force>, C<poweroff-immediate> have the effect
52             of powering down the system with similar semantics. C<exit> causes the manager to exit following
53             the normal shutdown procedure, and C<exit-force> causes it terminate without shutting down
54             services. When C<exit> or C<exit-force> is used by default the exit status of the
55             main process of the unit (if this applies) is returned from the service manager. However, this may be overridden
56             with C<FailureActionExitStatus>/C<SuccessActionExitStatus>, see
57             below.',
58             'migrate_from' => {
59             'formula' => '$service',
60             'variables' => {
61             'service' => '- - Service FailureAction'
62             }
63             },
64             'type' => 'leaf',
65             'value_type' => 'enum'
66             },
67             'SuccessAction',
68             {
69             'choice' => [
70             'none',
71             'reboot',
72             'reboot-force',
73             'reboot-immediate',
74             'poweroff',
75             'poweroff-force',
76             'poweroff-immediate',
77             'exit',
78             'exit-force'
79             ],
80             'description' => 'Configure the action to take when the unit stops and enters a failed state or inactive state.
81             Takes one of C<none>, C<reboot>, C<reboot-force>,
82             C<reboot-immediate>, C<poweroff>, C<poweroff-force>,
83             C<poweroff-immediate>, C<exit>, and C<exit-force>. In system mode,
84             all options are allowed. In user mode, only C<none>, C<exit>, and
85             C<exit-force> are allowed. Both options default to C<none>.
86              
87             If C<none> is set, no action will be triggered. C<reboot> causes a reboot
88             following the normal shutdown procedure (i.e. equivalent to systemctl reboot).
89             C<reboot-force> causes a forced reboot which will terminate all processes forcibly but should
90             cause no dirty file systems on reboot (i.e. equivalent to systemctl reboot -f) and
91             C<reboot-immediate> causes immediate execution of the
92             L<reboot(2)> system call, which
93             might result in data loss (i.e. equivalent to systemctl reboot -ff). Similarly,
94             C<poweroff>, C<poweroff-force>, C<poweroff-immediate> have the effect
95             of powering down the system with similar semantics. C<exit> causes the manager to exit following
96             the normal shutdown procedure, and C<exit-force> causes it terminate without shutting down
97             services. When C<exit> or C<exit-force> is used by default the exit status of the
98             main process of the unit (if this applies) is returned from the service manager. However, this may be overridden
99             with C<FailureActionExitStatus>/C<SuccessActionExitStatus>, see
100             below.',
101             'migrate_from' => {
102             'formula' => '$service',
103             'variables' => {
104             'service' => '- - Service SuccessAction'
105             }
106             },
107             'type' => 'leaf',
108             'value_type' => 'enum'
109             },
110             'StartLimitBurst',
111             {
112             'description' => 'Configure unit start rate limiting. Units which are started more than
113             burst times within an interval time span are
114             not permitted to start any more. Use C<StartLimitIntervalSec> to configure the
115             checking interval and C<StartLimitBurst> to configure how many starts per interval
116             are allowed.
117              
118             interval is a time span with the default unit of seconds, but other
119             units may be specified, see
120             L<systemd.time(5)>.
121             Defaults to C<DefaultStartLimitIntervalSec> in manager configuration file, and may
122             be set to 0 to disable any kind of rate limiting. burst is a number and
123             defaults to C<DefaultStartLimitBurst> in manager configuration file.
124              
125             These configuration options are particularly useful in conjunction with the service setting
126             C<Restart> (see
127             L<systemd.service(5)>);
128             however, they apply to all kinds of starts (including manual), not just those triggered by the
129             C<Restart> logic.
130              
131             Note that units which are configured for C<Restart>, and which reach the start
132             limit are not attempted to be restarted anymore; however, they may still be restarted manually or
133             from a timer or socket at a later point, after the interval has passed.
134             From that point on, the restart logic is activated again. systemctl reset-failed
135             will cause the restart rate counter for a service to be flushed, which is useful if the administrator
136             wants to manually start a unit and the start limit interferes with that. Rate-limiting is enforced
137             after any unit condition checks are executed, and hence unit activations with failing conditions do
138             not count towards the rate limit.
139              
140             When a unit is unloaded due to the garbage collection logic (see above) its rate limit counters
141             are flushed out too. This means that configuring start rate limiting for a unit that is not
142             referenced continuously has no effect.
143              
144             This setting does not apply to slice, target, device, and scope units, since they are unit
145             types whose activation may either never fail, or may succeed only a single time.',
146             'migrate_from' => {
147             'formula' => '$service',
148             'variables' => {
149             'service' => '- - Service StartLimitBurst'
150             }
151             },
152             'type' => 'leaf',
153             'value_type' => 'uniline'
154             },
155             'StartLimitIntervalSec',
156             {
157             'description' => 'Configure unit start rate limiting. Units which are started more than
158             burst times within an interval time span are
159             not permitted to start any more. Use C<StartLimitIntervalSec> to configure the
160             checking interval and C<StartLimitBurst> to configure how many starts per interval
161             are allowed.
162              
163             interval is a time span with the default unit of seconds, but other
164             units may be specified, see
165             L<systemd.time(5)>.
166             Defaults to C<DefaultStartLimitIntervalSec> in manager configuration file, and may
167             be set to 0 to disable any kind of rate limiting. burst is a number and
168             defaults to C<DefaultStartLimitBurst> in manager configuration file.
169              
170             These configuration options are particularly useful in conjunction with the service setting
171             C<Restart> (see
172             L<systemd.service(5)>);
173             however, they apply to all kinds of starts (including manual), not just those triggered by the
174             C<Restart> logic.
175              
176             Note that units which are configured for C<Restart>, and which reach the start
177             limit are not attempted to be restarted anymore; however, they may still be restarted manually or
178             from a timer or socket at a later point, after the interval has passed.
179             From that point on, the restart logic is activated again. systemctl reset-failed
180             will cause the restart rate counter for a service to be flushed, which is useful if the administrator
181             wants to manually start a unit and the start limit interferes with that. Rate-limiting is enforced
182             after any unit condition checks are executed, and hence unit activations with failing conditions do
183             not count towards the rate limit.
184              
185             When a unit is unloaded due to the garbage collection logic (see above) its rate limit counters
186             are flushed out too. This means that configuring start rate limiting for a unit that is not
187             referenced continuously has no effect.
188              
189             This setting does not apply to slice, target, device, and scope units, since they are unit
190             types whose activation may either never fail, or may succeed only a single time.',
191             'migrate_from' => {
192             'formula' => '$unit || $service',
193             'use_eval' => '1',
194             'variables' => {
195             'service' => '- - Service StartLimitInterval',
196             'unit' => '- StartLimitInterval'
197             }
198             },
199             'type' => 'leaf',
200             'value_type' => 'uniline'
201             },
202             'RebootArgument',
203             {
204             'description' => 'Configure the optional argument for the
205             L<reboot(2)> system call if
206             C<StartLimitAction> or C<FailureAction> is a reboot action. This
207             works just like the optional argument to systemctl reboot command.',
208             'migrate_from' => {
209             'formula' => '$service',
210             'variables' => {
211             'service' => '- - Service RebootArgument'
212             }
213             },
214             'type' => 'leaf',
215             'value_type' => 'uniline'
216             }
217             ],
218             'include' => [
219             'Systemd::Section::Unit'
220             ],
221             'name' => 'Systemd::Section::ServiceUnit'
222             }
223             ]
224             ;
225