File tree 5 files changed +41
-2
lines changed
5 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -837,6 +837,18 @@ systemd::manage_dropin { 'maxloglevel.conf':
837
837
}
838
838
```
839
839
840
+ ##### have a unit instance auto run before user-<uid >.service
841
+
842
+ ``` puppet
843
+ systemd::manage_dropin { 'user-aklog.conf':
844
+ unit => 'user@.service',
845
+ unit_entry => {
846
+ 'After' => 'user-aklog@%i.service',
847
+ 'Requires' => 'user-aklog@%i.service'
848
+ }
849
+ }
850
+ ```
851
+
840
852
#### Parameters
841
853
842
854
The following parameters are available in the ` systemd::manage_dropin ` defined type:
@@ -2289,7 +2301,7 @@ custom datatype that validates different filenames for systemd units and unit te
2289
2301
* ** See also**
2290
2302
* https://www.freedesktop.org/software/systemd/man/systemd.unit.html
2291
2303
2292
- Alias of ` Pattern[/^[a-zA-Z0-9:\-_.\\@]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/] `
2304
+ Alias of ` Pattern[/^[a-zA-Z0-9:\-_.\\@% ]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/] `
2293
2305
2294
2306
### <a name =" Systemd--Unit--Install " ></a >` Systemd::Unit::Install `
2295
2307
Original file line number Diff line number Diff line change 41
41
# }
42
42
# }
43
43
#
44
+ # @example have a unit instance auto run before user-<uid>.service
45
+ # systemd::manage_dropin { 'user-aklog.conf':
46
+ # unit => 'user@.service',
47
+ # unit_entry => {
48
+ # 'After' => 'user-aklog@%i.service',
49
+ # 'Requires' => 'user-aklog@%i.service'
50
+ # }
51
+ # }
52
+ #
44
53
# @param unit The unit to create a dropfile for
45
54
# @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.
46
55
# @param ensure The state of this dropin file
Original file line number Diff line number Diff line change 64
64
}
65
65
end
66
66
67
+ context 'with an instance to instance relation' do
68
+ let ( :params ) do
69
+ super ( ) . merge (
70
+ unit_entry : {
71
+ 'After' => [ 'user-runtime-dir@%i.service' ] ,
72
+ 'Requires' => [ 'user-runtime-dir@%i.service' ] ,
73
+ }
74
+ )
75
+ end
76
+
77
+ it {
78
+ is_expected . to contain_systemd__dropin_file ( 'foobar.conf' ) .
79
+ with_content ( %r{^After=user-runtime-dir@%i.service$} ) .
80
+ with_content ( %r{^Requires=user-runtime-dir@%i.service$} )
81
+ }
82
+ end
83
+
67
84
context 'with a timer entry' do
68
85
let ( :params ) do
69
86
super ( ) . merge (
Original file line number Diff line number Diff line change 13
13
'extra.dot.scope' ,
14
14
'a:colon.path' ,
15
15
'an_underscore.device' ,
16
+ 'a_referenced_template_instance@%i.service' ,
16
17
'a-dash.slice' ,
17
18
] . each do |unit |
18
19
it { is_expected . to allow_value ( unit . to_s ) }
Original file line number Diff line number Diff line change 1
1
# @summary custom datatype that validates different filenames for systemd units and unit templates
2
2
# @see https://www.freedesktop.org/software/systemd/man/systemd.unit.html
3
- type Systemd::Unit = Pattern[/^[a-zA-Z0-9:\-_.\\@]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/]
3
+ type Systemd::Unit = Pattern[/^[a-zA-Z0-9:\-_.\\@% ]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/]
You can’t perform that action at this time.
0 commit comments