Bug 82724 - RFE: expose X- prefixed unit file settings and sections on the bus
Summary: RFE: expose X- prefixed unit file settings and sections on the bus
Status: NEW
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium enhancement
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-17 09:20 UTC by Márton Levente Szigeti
Modified: 2014-08-18 20:32 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Márton Levente Szigeti 2014-08-17 09:20:37 UTC
Currently systemd discards unknown sections in unit files with a message logged about doing so. Addig custom section support (for example, by prefixing the section name with a *) and making these available on D-Bus would open many possibilities: units could be augmented with data for non-systemd applications and would be completely in sync with systemd and wouldn't require parsing unit files by applications.

A few possible use cases:
* Creating a monitd-like monitoring application with its tests defined with the services they are supposed to check
* CoreOS's Fleet currently does this with X-Fleet sections
* And many more I can't think of :)

As an example:

/etc/systemd/system/freeradius.service:

.include /usr/lib/systemd/system/freeradius.service

[*Test1]
Name=Test with good credentials
Exec=/usr/local/test-freeradius.sh

[*Test2]
Name=Test with good credentials using expect script
ExpectCmd=/usr/local/test-freeradius.exp

--

And the org.freedesktop.systemd1.Unit interface could have a CustomSections property (an array of section names) and a GetCustomProperty(String SectionName, String PropertyName) method:

/org/freedesktop/systemd1/unit/freeradius_2eservice
 CustomSections = ["Test1","Test2"]
 GetCustomProperty("Test1", "Name") -> "Test with good credentials using expect script"
Comment 1 Lennart Poettering 2014-08-18 13:01:41 UTC
All unit file settings and sections starting with "X-" will be ignored by systemd's own parsers. They are intended to be used by other apps to enrich the unit files with their own meta data.

There's also a TODO list item to make these settings and fields queriable via some unit bus properties. Happy to take a patch for that.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.