Skip to content

Commit 097d030

Browse files
authored
Merge pull request #1788 from jouvin/systemd_undefined_unit
ncm-systemd: ensure unit property is defined
2 parents d655111 + 6ee9ea9 commit 097d030

File tree

1 file changed

+8
-6
lines changed
  • ncm-systemd/src/main/pan/components/systemd

1 file changed

+8
-6
lines changed

ncm-systemd/src/main/pan/components/systemd/schema.pan

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type hwloc_location = string with match(SELF, '^[\w:.]+$');
1717
syslog facility to use when logging to syslog
1818
}
1919
type syslog_facility = string with match(SELF,
20-
'^(kern|user|mail|daemon|auth|syslog|lprnews|uucp|cron|authpriv|ftp|local[0-7])$'
20+
'^(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|authpriv|ftp|local[0-7])$'
2121
);
2222

2323
@documentation{
@@ -545,11 +545,13 @@ type ${project.artifactId}_component = {
545545
# escaped full unitnames are allowed (or use shortnames and type)
546546
"unit" ? ${project.artifactId}_unit_type{}
547547
} with {
548-
foreach(name; unit; SELF["unit"]) {
549-
if (unit["type"] == "mount" && exists(unit["file"]) && exists(unit["file"]["config"]["mount"])) {
550-
goodname = systemd_make_mountunit(unit["file"]["config"]["mount"]["Where"]);
551-
if(goodname != name) {
552-
error('Incorrect name for mount unit, the name must match Where: %s vs %s', name, goodname);
548+
if (is_defined(SELF["unit"])) {
549+
foreach(name; unit; SELF["unit"]) {
550+
if (unit["type"] == "mount" && exists(unit["file"]) && exists(unit["file"]["config"]["mount"])) {
551+
goodname = systemd_make_mountunit(unit["file"]["config"]["mount"]["Where"]);
552+
if(goodname != name) {
553+
error('Incorrect name for mount unit, the name must match Where: %s vs %s', name, goodname);
554+
};
553555
};
554556
};
555557
};

0 commit comments

Comments
 (0)