We’re working with a fairly large Icinga2 configuration, totaling over 120k lines of code spread across roughly 600 config files that have grown organically over time.
Lately, we’ve been wanting to clean up (i.e., refactor) the configuration, particularly focusing on standardizing indentation. Ideally, we’d like to do this automatically.
Has anyone here encountered a similar challenge and found a solution?
The ideal scenario would be a tool (similar to Prettier for JavaScript or GNU Indent for C) that could strip all existing formatting and reformat everything according to a standardized style. It would also be great if it could be used as a pre-commit hook to maintain consistency in future configurations.
Thanks in advance for any advice or recommendations!
If, by any chance, you would like to start something to handle Icinga2 code, I would be quite interested.
A proper parser/compiler outside of icinga2 would be really helpful, but I did not yet find time and motivation for such a task yet.
There are syntax highlight configs for vim and nano (Addons - Icinga 2) which might also be a starting point!? Though, I don’t use them, so I don’t know if they’re up to date.
At the moment, we’re exploring a few different approaches, but it’s still too early to provide any concrete updates. If we manage to come up with a viable solution, we’ll definitely share it with the community.
We agree that a full-fledged parser/compiler outside of Icinga2 would be extremely helpful, but interpreting and processing the configuration is a much larger task than simply handling indentation. For now, we’re focused on finding a practical solution to our specific issue, even if it ends up being a “98% solution” rather than perfect.