Add systemd output format#107
Open
ruuda wants to merge 17 commits into
Open
Conversation
It doesn't yet handle dicts, which would be useful for Environment=, but we can handle that later. It also doesn't handle repeated sections, which networkd needs, but we can also handle that in a follow-up commit.
Because I want the rendered unit to look like one I would write by hand, most strings unquoted. Maybe that's the same pitfall as yaml, but it's not as prevalent in systemd, and anyway this is about output only.
It does make this format less ergonomic to use, since now you need to add more layers of lists, and the output can be less pretty, but I'm afraid this is required for correctness.
So long command lines remain somewhat readable in the generated files.
Also fix an error message that was still referring to TOML.
Systemd behaves quite differently than TOML here. More ad-hoc, unfortunately.
Until now the output formats were relatively straightforward, but the systemd output format is going to be a bit more involved, we need a place to document it.
This tests a few more weird cases that I thought of while writing the docs. Even though line coverage is at 100% already, there are some boolean expressions and recursion that were not yet covered, better to confirm it explicitly. Especially the empty string case matters, previously it was impossible to pass an empty string in a command!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
systemdoutput format, so RCL can natively generate systemd units, and you don't have to patch them together using string formatting. This is superficially similar to the toml format, though systemd unit files are more imperative than declarative, so it ended up being a bit more involved.