mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
systemd: Allow comments at the top of units
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>
This commit is contained in:
parent
28b85e0374
commit
ee86c2add3
@ -24,6 +24,11 @@ def parse_unit(unit_path):
|
|||||||
if line == "":
|
if line == "":
|
||||||
continue
|
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[0] == "[" and line[-1] == "]":
|
||||||
if line not in SECTIONS:
|
if line not in SECTIONS:
|
||||||
print("Unknown section {}".format(line))
|
print("Unknown section {}".format(line))
|
||||||
|
Loading…
Reference in New Issue
Block a user