]> xenbits.xensource.com Git - libvirt.git/commitdiff
systemd: Allow comments at the top of units
authorAndrea Bolognani <abologna@redhat.com>
Fri, 29 Sep 2023 13:28:25 +0000 (15:28 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 25 Oct 2023 10:19:32 +0000 (12:19 +0200)
Currently the script will reject any type of contents outside
of a section, but we want to be able to have some useful
comments at the top of each file to help users understand how
they are processed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
scripts/merge-systemd-units.py

index 30e8757544845f0a7e74c7d552f2d3b5c207d933..869d857f1da284cdce7d09c6ea84d9eb1bab2f68 100755 (executable)
@@ -24,6 +24,11 @@ def parse_unit(unit_path):
             if line == "":
                 continue
 
+            # Comments at the very top of the file, outside of any
+            # section, are allowed and will not show up in the output
+            if line[0] == "#" and current_section == "[Invalid]":
+                continue
+
             if line[0] == "[" and line[-1] == "]":
                 if line not in SECTIONS:
                     print("Unknown section {}".format(line))