-
Notifications
You must be signed in to change notification settings - Fork 52
/
schema.pan
549 lines (510 loc) · 23 KB
/
schema.pan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# ${license-info}
# ${developer-info}
# ${author-info}
declaration template components/${project.artifactId}/schema;
include 'quattor/types/component';
include 'components/accounts/functions';
# TODO: issue https://github.com/quattor/template-library-core/issues/97: some generic types, candidates for template-library-core
@documentation{
hwloc (Portable Hardware Locality, hwloc(7)) location, e.g. node:1 for NUMAnode 1
}
type hwloc_location = string with match(SELF, '^[\w:.]+$');
@documentation{
syslog facility to use when logging to syslog
}
type syslog_facility = string with match(SELF,
'^(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|authpriv|ftp|local[0-7])$');
@documentation{
syslog level to use when logging to syslog or the kernel log buffer
}
type syslog_level = string with match(SELF, '^(emerg|alert|crit|err|warning|notice|info|debug)$');
type ${project.artifactId}_skip = {
"service" : boolean = false
} = dict();
type ${project.artifactId}_unit_architecture = string with match(SELF,
'^(native|x86(-64)?|ppc(64)?(-le)?|ia64|parisc(64)?|s390x?|sparc(64)?)' +
'|mips(-le)?|alpha|arm(64)?(-be)?|sh(64)?|m86k|tilegx|cris$');
type ${project.artifactId}_unit_security = string with match(SELF, '^!?(selinux|apparmor|ima|smack|audit)$');
type ${project.artifactId}_unit_virtualization = string with match(SELF,
'^(0|1|vm|container|qemu|kvm|zvm|vmware|microsoft|oracle|xen' +
'|bochs|uml|openvz|lxc(-libvirt)?|systemd-nspawn|docker)$');
# TODO: https://github.com/quattor/configuration-modules-core/issues/646:
# make this more finegrained, e.g. has to be existing unit; or check types
type ${project.artifactId}_valid_unit = string;
# executable paths can have a number of special prefixes
type ${project.artifactId}_valid_execpath = string with match(SELF, '^([@+!:-]|!!)?/');
# type for a relative directory: no leading / and may not include ".."
type ${project.artifactId}_relative_directory = string with !match(SELF, '(^/|\.\.)');
@documentation{
Validate that a property is either a size (in bytes), a relative size (in %)
or 'infinity'. Used for memory limits in cgroups.
}
function is_absolute_or_relative_size = {
l = ARGV[0];
if (is_long(l) && l > 0) {
return(true);
};
if (is_string(l) && match(l, '^(infinity|100%|[0-9]?[0-9]%)$')) {
return(true);
};
false;
};
type ${project.artifactId}_absolute_or_relative_size = element with is_absolute_or_relative_size(SELF);
type ${project.artifactId}_weights = long(1..10000);
# adding new ones
# go to http://www.freedesktop.org/software/systemd/man/systemd.directives.html
# and follow the link to the manual
@documentation{
Condition/Assert entries in Unit section
All lists can start with empty string to reset previously defined values.
}
type ${project.artifactId}_unitfile_config_unit_condition = {
'ACPower' ? boolean
'Architecture' ? ${project.artifactId}_unit_architecture[]
'Capability' ? linux_capability[]
'DirectoryNotEmpty' ? string[]
'FileIsExecutable' ? string[]
'FileNotEmpty' ? string[]
'FirstBoot' ? boolean
'Host' ? string[] # TODO: make custom type for hostname or machineid
'KernelCommandLine' ? string[]
'NeedsUpdate' ? string with match(SELF, '^!?/(var|etc)')
'PathExistsGlob' ? string[]
'PathExists' ? string[]
'PathIsDirectory' ? string[]
'PathIsMountPoint' ? string[]
'PathIsReadWrite' ? string[]
'PathIsSymbolicLink' ? string[]
'Security' ? ${project.artifactId}_unit_security[]
'Virtualization' ? ${project.artifactId}_unit_virtualization[]
};
@documentation{
the [Unit] section
http://www.freedesktop.org/software/systemd/man/systemd.unit.html#%5BUnit%5D%20Section%20Options
}
type ${project.artifactId}_unitfile_config_unit = {
'After' ? ${project.artifactId}_valid_unit[]
'AllowIsolate' ? boolean
'Assert' ? ${project.artifactId}_unitfile_config_unit_condition
'Before' ? ${project.artifactId}_valid_unit[]
'BindsTo' ? ${project.artifactId}_valid_unit[]
'Condition' ? ${project.artifactId}_unitfile_config_unit_condition
'Conflicts' ? ${project.artifactId}_valid_unit[]
'DefaultDependencies' ? boolean
'Description' ? string
'Documentation' ? string
'IgnoreOnIsolate' ? boolean
'IgnoreOnSnapshot' ? boolean
'JobTimeoutAction' ? string
'JobTimeoutRebootArgument' ? string
'JobTimeoutSec' ? long(0..)
'JoinsNamespaceOf' ? ${project.artifactId}_valid_unit[]
'NetClass' ? string
'OnFailure' ? string[]
'OnFailureJobMode' ? string with match(SELF,
'^(fail|replace(-irreversibly)?|isolate|flush|ignore-(dependencies|requirements))$')
'PartOf' ? ${project.artifactId}_valid_unit[]
'PropagatesReloadTo' ? string[]
'RefuseManualStart' ? boolean
'RefuseManualStop' ? boolean
'ReloadPropagatedFrom' ? string[]
'Requires' ? ${project.artifactId}_valid_unit[]
'RequiresMountsFor' ? string[]
'RequiresOverridable' ? ${project.artifactId}_valid_unit[]
'Requisite' ? ${project.artifactId}_valid_unit[]
'RequisiteOverridable' ? ${project.artifactId}_valid_unit[]
'SourcePath' ? string
'StopWhenUnneeded' ? boolean
'Wants' ? ${project.artifactId}_valid_unit[]
};
@documentation{
the [Install] section
http://www.freedesktop.org/software/systemd/man/systemd.unit.html#%5BInstall%5D%20Section%20Options
}
type ${project.artifactId}_unitfile_config_install = {
'Alias' ? string[]
'Also' ? ${project.artifactId}_valid_unit[]
'DefaultInstance' ? string
'RequiredBy' ? ${project.artifactId}_valid_unit[]
'WantedBy' ? ${project.artifactId}_valid_unit[]
};
type ${project.artifactId}_unitfile_config_systemd_exec_stdouterr = string with match(SELF,
'^(inherit|null|tty|journal|syslog|kmsg|journal+console|syslog+console|kmsg+console|socket)$');
@documentation{
systemd.kill directives
http://www.freedesktop.org/software/systemd/man/systemd.kill.html
valid for [Service], [Socket], [Mount], or [Swap] sections
}
type ${project.artifactId}_unitfile_config_systemd_kill = {
'KillMode' ? string with match(SELF, '^(control-group|process|mixed|none)$')
'KillSignal' ? string with match(SELF,
'^SIG(HUP|INT|QUIT|ILL|ABRT|FPE|KILL|SEGV|PIPE|ALRM|TERM|USR[12]|CHLD|CONT|STOP|T(STP|TIN|TOU))$')
'SendSIGHUP' ? boolean
'SendSIGKILL' ? boolean
};
@documentation{
systemd.exec directives
http://www.freedesktop.org/software/systemd/man/systemd.exec.html
valid for [Service], [Socket], [Mount], or [Swap] sections
}
type ${project.artifactId}_unitfile_config_systemd_exec = {
'CacheDirectoryMode' ? type_octal_mode
'CacheDirectory' ? ${project.artifactId}_relative_directory[]
'ConfigurationDirectoryMode' ? type_octal_mode
'ConfigurationDirectory' ? ${project.artifactId}_relative_directory[]
'CPUAffinity' ? long[][] # start with empty list to reset
'CPUSchedulingPolicy' ? string with match(SELF, '^(other|batch|idle|fifo|rr)$')
'CPUSchedulingPriority' ? long(1..99) # 99 = highest
'CPUSchedulingResetOnFork' ? boolean
'Environment' ? string{}[] # start with empty list
'EnvironmentFile' ? string[] # overrides variables defined in Environment
'Group' ? defined_group
'IOSchedulingClass' ? string with match(SELF, '^([0-3]|none|realtime|best-effort|idle)$')
'IOSchedulingPriority' ? long(0..7) # 0 = highest
'LimitAS' ? long(-1..) # The maximum size of the process's virtual memory (address space) in bytes.
'LimitCORE' ? long(-1..) # Maximum size of a core file
'LimitCPU' ? long(-1..) # CPU time limit in seconds
'LimitDATA' ? long(-1..) # he maximum size of the process's data segment (initialized data, uninitialized data, and heap)
'LimitFSIZE' ? long(-1..) # The maximum size of files that the process may create
'LimitLOCKS' ? long(-1..) # (Early Linux 2.4 only) A limit on the number of locks
'LimitMEMLOCK' ? long(-1..) # The maximum number of bytes of memory that may be locked into RAM
'LimitMSGQUEUE' ? long(-1..) # pecifies the limit on the number of bytes that can be allocated for POSIX message queues for the real user ID of the calling process.
'LimitNICE' ? long(0..40) # Specifies a ceiling to which the process's nice value can be raised. The actual ceiling for the nice value is calculated as 20 - rlim_cur.
'LimitNOFILE' ? long(-1..) # Specifies a value one greater than the maximum file descriptor number that can be opened by this process.
'LimitNPROC' ? long(-1..) # The maximum number of processes (or, more precisely on Linux, threads) that can be created for the real user ID of the calling process.
'LimitRSS' ? long(-1..) # Specifies the limit (in pages) of the process's resident set (the number of virtual pages resident in RAM).
'LimitRTPRIO' ? long(-1..) # Specifies a ceiling on the real-time priority that may be set for this process
'LimitRTTIME' ? long(-1..) # Specifies a limit (in microseconds) on the amount of CPU time that a process scheduled under a real-time scheduling policy may consume without making a blocking system call.
'LimitSIGPENDING' ? long(-1..) # Specifies the limit on the number of signals that may be queued for the real user ID of the calling process.
'LimitSTACK' ? long(-1..) # The maximum size of the process stack, in bytes.
'LogsDirectoryMode' ? type_octal_mode
'LogsDirectory' ? ${project.artifactId}_relative_directory[]
'Nice' ? long(-20..19)
'OOMScoreAdjust' ? long(-1000..1000)
'PrivateTmp' ? boolean
'PrivateNetwork' ? boolean
'RootDirectory' ? ${project.artifactId}_relative_directory
'RuntimeDirectoryMode' ? type_octal_mode
'RuntimeDirectoryPreserve' ? choice('yes', 'no', 'restart')
'RuntimeDirectory' ? ${project.artifactId}_relative_directory[]
'StandardError' ? ${project.artifactId}_unitfile_config_systemd_exec_stdouterr
'StandardInput' ? string with match(SELF, '^(null|tty(-(force|fail))?|socket)$')
'StandardOutput' ? ${project.artifactId}_unitfile_config_systemd_exec_stdouterr
'StateDirectoryMode' ? type_octal_mode
'StateDirectory' ? ${project.artifactId}_relative_directory[]
'SupplementaryGroups' ? defined_group[]
'SyslogFacility' ? syslog_facility
'SyslogIdentifier' ? string
'SyslogLevel' ? syslog_level
'SyslogLevelPrefix' ? boolean
'TTYPath' ? string
'TTYReset' ? boolean
'TTYVHangup' ? boolean
'TTYVTDisallocate' ? boolean
'UMask' ? type_octal_mode
'User' ? defined_user
'WorkingDirectory' ? string
};
type ${project.artifactId}_unitfile_config_systemd_resource_control_devicelist = string[] with length(SELF) == 2 &&
match(SELF[0], '^(char-|block-|/dev/)') && match(SELF[1], '^[rwm]{1,3}$');
type ${project.artifactId}_unitfile_config_systemd_resource_control_block_weight = string[] with length(SELF) == 2 &&
match(SELF[0], '^/') && match(SELF[1], '^[0-9]+$');
@documentation{
systemd.resource-control directives
https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html
valid for [Slice], [Scope], [Service], [Socket], [Mount], or [Swap] sections
}
type ${project.artifactId}_unitfile_config_systemd_resource_control = {
'CPUAccounting' ? boolean
'CPUShares' ? long(2..262144)
'CPUWeight' ? ${project.artifactId}_weights
'StartupCPUWeight' ? ${project.artifactId}_weights
'StartupCPUShares' ? long(2..262144)
'CPUQuota' ? long(0..100) # percentages
'MemoryAccounting' ? boolean
'MemoryLimit' ? ${project.artifactId}_absolute_or_relative_size
'MemoryMin' ? ${project.artifactId}_absolute_or_relative_size
'MemoryMax' ? ${project.artifactId}_absolute_or_relative_size
'MemoryLow' ? ${project.artifactId}_absolute_or_relative_size
'MemoryHigh' ? ${project.artifactId}_absolute_or_relative_size
'MemorySwapMax' ? ${project.artifactId}_absolute_or_relative_size
'TasksAccounting' ? boolean
'TasksMax' ? string with match(SELF, '^([0-9]+%?|infinity)$')
'BlockIOAccounting' ? boolean
'BlockIOWeight' ? long(10..1000)
'IOWeight' ? ${project.artifactId}_weights
'StartupIOWeight' ? ${project.artifactId}_weights
'StartupBlockIOWeight' ? long(10..1000)
'BlockIODeviceWeight' ? ${project.artifactId}_unitfile_config_systemd_resource_control_block_weight[]
'BlockIOReadBandwidth' ? ${project.artifactId}_unitfile_config_systemd_resource_control_block_weight[]
'BlockIOWriteBandwidth' ? ${project.artifactId}_unitfile_config_systemd_resource_control_block_weight[]
'IPAccounting' ? boolean
'IPAddressAllow' ? type_network_name[]
'DeviceAllow' ? ${project.artifactId}_unitfile_config_systemd_resource_control_devicelist[]
'DevicePolicy' ? choice('auto', 'closed', 'strict')
'Slice' ? string
'Delegate' ? boolean
};
@documentation{
the [Service] section
http://www.freedesktop.org/software/systemd/man/systemd.service.html
}
type ${project.artifactId}_unitfile_config_service = {
include ${project.artifactId}_unitfile_config_systemd_exec
include ${project.artifactId}_unitfile_config_systemd_kill
include ${project.artifactId}_unitfile_config_systemd_resource_control
'AmbientCapabilities' ? linux_capability[]
'BusName' ? string
'BusPolicy' ? string[] with length(SELF) == 2 && match(SELF[1], '^(see|talk|own)$')
'CapabilityBoundingSet' ? linux_capability[]
'ExecReload' ? transitional_string_or_list_of_strings
'ExecStart' ? transitional_string_or_list_of_strings
'ExecStartPost' ? transitional_string_or_list_of_strings
'ExecStartPre' ? transitional_string_or_list_of_strings
'ExecStop' ? transitional_string_or_list_of_strings
'ExecStopPost' ? transitional_string_or_list_of_strings
'GuessMainPID' ? boolean
'NonBlocking' ? boolean
'NotifyAccess' ? string with match(SELF, '^(none|main|all)$')
'PIDFile' ? string with match(SELF, '^/')
'PermissionsStartOnly' ? boolean
'RemainAfterExit' ? boolean
'Restart' ? string with match(SELF, '^(no|on-(success|failure|abnormal|watchdog|abort)|always)$')
'RestartForceExitStatus' ? long[]
'RestartPreventExitStatus' ? long[]
'RestartSec' ? long(0..) # TODO default is 100ms, which can't be expressed like this
'RootDirectoryStartOnly' ? boolean
'Sockets' ? ${project.artifactId}_valid_unit[]
'SuccessExitStatus' ? long[]
'TimeoutSec' ? long(0..)
'TimeoutStartSec' ? long(0..)
'TimeoutStopSec' ? long(0..)
'Type' ? string with match(SELF, '^(simple|forking|oneshot|dbus|notify|idle)$')
'WatchdogSec' ? long(0..)
} with {
if(exists(SELF['Type']) && (SELF['Type'] == 'dbus') && (! exists(SELF['BusName']))) {
error('BusName has to be specified with Type=dbus');
};
true;
};
@documentation{
the [Socket] section
http://www.freedesktop.org/software/systemd/man/systemd.socket.html
}
type ${project.artifactId}_unitfile_config_socket = {
include ${project.artifactId}_unitfile_config_systemd_exec
include ${project.artifactId}_unitfile_config_systemd_kill
include ${project.artifactId}_unitfile_config_systemd_resource_control
'ListenStream' ? string[]
'ListenDatagram' ? string[]
'ListenSequentialPacket' ? string[]
'ListenFIFO' ? absolute_file_path
'ListenSpecial' ? absolute_file_path
'ListenNetlink' ? string
'ListenMessageQueue' ? string with match(SELF, '^/')
'ListenUSBFunction' ? string
'SocketProtocol' ? choice('udplite', 'sctp')
'BindIPv6Only' ? choice('default', 'both', 'ipv6-only')
'Backlog' ? long(0..)
'BindToDevice' ? string
'SocketUser' ? defined_user
'SocketGroup' ? defined_group
'SocketMode' ? type_octal_mode
'DirectoryMode' ? type_octal_mode
'Accept' ? boolean
'Writable' ? boolean
'MaxConnections' ? long(0..)
'MaxConnectionsPerSource' ? long(0..)
'KeepAlive' ? boolean
'KeepAliveTimeSec' ? long(0..)
'KeepAliveIntervalSec' ? long(0..)
'KeepAliveProbes' ? long(0..)
'NoDelay' ? boolean
'Priority' ? long(0..)
'DeferAcceptSec' ? long(0..)
'ReceiveBuffer' ? long(0..)
'SendBuffer' ? long(0..)
'IPTOS' ? string with match(SELF, '^([0-9]+|low-delay|throughput|reliability|low-cost)$')
'IPTTL' ? long
'Mark' ? long
'ReusePort' ? boolean
'SmackLabel' ? string
'SmackLabelIPIn' ? string
'SmackLabelIPOut' ? string
'SELinuxContextFromNet' ? boolean
'PipeSize' ? long(0..)
'MessageQueueMaxMessages' ? long
'MessageQueueMessageSize' ? long
'FreeBind' ? boolean
'Transparent' ? boolean
'Broadcast' ? boolean
'PassCredentials' ? boolean
'PassSecurity' ? boolean
'TCPCongestion' ? choice('westwood', 'veno', 'cubic', 'lp')
'ExecStartPost' ? ${project.artifactId}_valid_execpath[]
'ExecStartPre' ? ${project.artifactId}_valid_execpath[]
'ExecStopPre' ? ${project.artifactId}_valid_execpath[]
'ExecStopPost' ? ${project.artifactId}_valid_execpath[]
'TimeoutSec' ? long(0..)
'Service' ? string
'RemoveOnStop' ? boolean
'Symlinks' ? string[]
'FileDescriptorName' ? string with match(SELF, '^[^:]{1,255}$')
'TriggerLimitIntervalSec' ? long(0..)
'TriggerLimitBurst' ? long(0..)
} with {
if(exists(SELF['Service']) && exists(SELF['Accept']) && SELF['Accept']) {
error('You can only specify a Service when Accept=false');
};
true;
};
@documentation{
the [Path] section
https://www.freedesktop.org/software/systemd/man/systemd.path.html
}
type ${project.artifactId}_unitfile_config_path = {
'PathExists' ? absolute_file_path
'PathExistsGlob' ? absolute_file_path
'PathChanged' ? absolute_file_path
'PathModified' ? absolute_file_path
'DirectoryNotEmpty' ? absolute_file_path
'Unit' ? string
'MakeDirectory' ? boolean
'DirectoryMode' ? type_octal_mode
'TriggerLimitIntervalSec' ? long(0..)
'TriggerLimitBurst' ? long(0..)
};
@documentation{
the [mount] section
http://www.freedesktop.org/software/systemd/man/systemd.mount.html
}
type ${project.artifactId}_unitfile_config_mount = {
include ${project.artifactId}_unitfile_config_systemd_exec
include ${project.artifactId}_unitfile_config_systemd_kill
'What': string
'Where': absolute_file_path
'Type' ? string
'Options' ? string[]
'SloppyOptions' ? boolean
'LazyUnmount' ? boolean
'ReadWriteOnly' ? boolean
'ForceUnmount' ? boolean
'DirectoryMode' ? type_octal_mode
'TimeoutSec' ? long(0..)
};
@documentation{
the [Automount] section
http://www.freedesktop.org/software/systemd/man/systemd.automount.html
}
type ${project.artifactId}_unitfile_config_automount = {
'Where': absolute_file_path
'DirectoryMode' ? type_octal_mode
'TimeoutIdleSec' ? long(0..)
};
@documentation{
the [Timer] section
http://www.freedesktop.org/software/systemd/man/systemd.timer.html
}
type ${project.artifactId}_unitfile_config_timer = {
'OnActiveSec' ? long(0..)
'OnBootSec' ? long(0..)
'OnStartupSec' ? long(0..)
'OnUnitActiveSec' ? long(0..)
'OnUnitInactiveSec' ? long(0..)
'OnCalendar' ? string[]
'AccuracySec' ? long(0..)
'RandomizedDelaySec' ? long(0..)
'FixedRandomDelay' ? boolean
'OnClockChange' ? boolean
'OnTimezoneChange' ? boolean
'Unit' ? string
'Persistent' ? boolean
'WakeSystem' ? boolean
'RemainAfterElapse' ? boolean
};
@documentation{
the [Slice] section
http://www.freedesktop.org/software/systemd/man/systemd.slice.html
}
type ${project.artifactId}_unitfile_config_slice = {
include ${project.artifactId}_unitfile_config_systemd_resource_control
};
@documentation{
Unit configuration sections
includes, unit and install are type agnostic
unit and install are mandatory, but not enforced by schema (possible issues in case of replace=true)
the other attributes are only valid for a specific type
}
type ${project.artifactId}_unitfile_config = {
@{list of existing/other units to base the configuration on
(e.g. when creating a new service with a different name, based on an exsiting one)}
'includes' ? string[]
'install' ? ${project.artifactId}_unitfile_config_install
'service' ? ${project.artifactId}_unitfile_config_service
'socket' ? ${project.artifactId}_unitfile_config_socket
'mount' ? ${project.artifactId}_unitfile_config_mount
'automount' ? ${project.artifactId}_unitfile_config_automount
'path' ? ${project.artifactId}_unitfile_config_path
'timer' ? ${project.artifactId}_unitfile_config_timer
'unit' ? ${project.artifactId}_unitfile_config_unit
'slice' ? ${project.artifactId}_unitfile_config_slice
};
@documentation{
Custom unit configuration to allow inserting computed configuration data
It overrides the data defined in the regular config schema,
so do not forget to set those as well (can be dummy value).
}
type ${project.artifactId}_unitfile_custom = {
@{CPUAffinity list determined via
'hwloc-calc --physical-output --intersect PU <location0> <location1>'
Allows to cpubind on numanodes (as we cannot trust logical CPU indices, which regular CPUAffinity requires)
Forces an empty list to reset any possible previously defined affinity.}
'CPUAffinity' ? hwloc_location[]
};
@documentation{
Unit file configuration
}
type ${project.artifactId}_unitfile = {
@{unitfile configuration data}
"config" : ${project.artifactId}_unitfile_config
@{custom unitfile configuration data}
"custom" ? ${project.artifactId}_unitfile_custom
@{replaceunitfile configuration: if true, only the defined parameters will be used by the unit; anything else is ignored}
"replace" : boolean = false
@{only use the unit parameters for unitfile configuration,
ignore other defined here such as targets (but still allow e.g. values defined by legacy chkconfig)}
"only" ? boolean
};
# legacy conversion
# 1 -> rescue
# 234 -> multi-user
# 5 -> graphical
# for now limit the targets
type ${project.artifactId}_target = string with match(SELF, "^(default|poweroff|rescue|multi-user|graphical|reboot)$");
type ${project.artifactId}_unit_type = {
"name" ? string # shortnames are ok; fullnames require matching type
"targets" : ${project.artifactId}_target[] = list("multi-user")
"type" : choice('service', 'target', 'sysv', 'socket', 'mount', 'automount', 'timer', 'slice', 'path') = 'service'
"startstop" : boolean = true
"state" : string = 'enabled' with match(SELF, '^(enabled|disabled|masked)$')
@{unitfile configuration}
"file" ? ${project.artifactId}_unitfile
};
type ${project.artifactId}_component = {
include structure_component
"skip" : ${project.artifactId}_skip
@{what to do with unconfigured units: ignore, enabled, disabled, on (enabled+start), off (disabled+stop; advanced option)}
"unconfigured" : string = 'ignore' with match (SELF, '^(ignore|enabled|disabled|on|off)$') # harmless default
# escaped full unitnames are allowed (or use shortnames and type)
"unit" ? ${project.artifactId}_unit_type{}
} with {
foreach(name; unit; SELF["unit"]) {
if (unit["type"] == "mount" && exists(unit["file"]) && exists(unit["file"]["config"]["mount"])) {
goodname = systemd_make_mountunit(unit["file"]["config"]["mount"]["Where"]);
if(goodname != name) {
error('Incorrect name for mount unit, the name must match Where: %s vs %s', name, goodname);
};
};
};
true;
};