agent
agent copied to clipboard
Move file format handling out of systemdunit.rs
The module provider.systemdmanager.systemdunit is complex and hard to test because the service unit logic and the underlying INI file format are merged together. For more popular file formats like XML, JSON, and YAML it is obvious to use a separate module or library. The same can be done for the INI file format.
Furthermore the mapping from Kubernetes to a systemd service could be factored out. This would yield the following modules:
service_generatorwhich maps aPodSpecto aSystemdService.systemd_servicewhich provides the structureSystemdServiceand a functionserializewhich maps this structure to anIniFileand callsserializeon it.ini_filewith a structureIniFileand a functionserialize.
The amount of code would be roughly the same but there would be smaller and better testable modules.