This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Let ConfigParser parse systemd units
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: bbayles, cooperlees, johnlinp, lukasz.langa, mcepl
Priority: normal Keywords:

Created on 2017-09-20 08:40 by johnlinp, last changed 2022-04-11 14:58 by admin.

Messages (1)
msg302604 - (view) Author: 林自均 (johnlinp) * Date: 2017-09-20 08:40
Although systemd units are inspired by .ini format, ConfigParser is unable to parse those files because:

1. Multiple assignments to the same option in systemd units are concatenated with white spaces.
2. Multiple sections with the same section name are merged.
3. An option assignment of empty value resets the option.

I suggest 3 corresponding parameters in ConfigParser.__init__():

1. merge_options: If set to True, multiple assignment to the same option are concatenated with white spaces. Default is False.
2. merge_sections: If set to True, multiple sections with the same name are merged. Default is False.
3. empty_is_reset: Only relevant when merge_options is True. If set to True, an option assignment of empty value will reset the option. Default is False.
History
Date User Action Args
2022-04-11 14:58:52adminsetgithub: 75709
2021-09-02 23:45:07cooperleessetnosy: + cooperlees
2018-03-05 14:16:43bbaylessetnosy: + bbayles
2018-03-05 12:08:13serhiy.storchakasetnosy: + lukasz.langa

versions: + Python 3.8, - Python 3.7
2018-03-05 12:02:15mceplsetnosy: + mcepl
2017-09-20 08:40:09johnlinpcreate