Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncm-systemd 24.10.0: validation fails if no unit is defined #1787

Closed
jouvin opened this issue Dec 10, 2024 · 4 comments · Fixed by #1788
Closed

ncm-systemd 24.10.0: validation fails if no unit is defined #1787

jouvin opened this issue Dec 10, 2024 · 4 comments · Fixed by #1788
Milestone

Comments

@jouvin
Copy link
Contributor

jouvin commented Dec 10, 2024

In ncm-systemd since 21.12.0, a validation has been added to the schema for the main type systemd_component that accesses unit property in the structure. If the component has been loaded but no unit has been defined, this result in a validation error has the unit property is undefined.

@jouvin jouvin added this to the 25.next milestone Dec 10, 2024
@jouvin
Copy link
Contributor Author

jouvin commented Dec 10, 2024

Unfortunately a trivial fix like initializing unit with an empty dict doesn't work (not supported in Pan, when the type is a subtype if I'm right). And probably just disabling the validation when unit is not defined will not help as it will probably cause other problems when the component is executed...

@jrha
Copy link
Member

jrha commented Dec 10, 2024

Is supporting this actually a required use case?

@jouvin
Copy link
Contributor Author

jouvin commented Dec 11, 2024

It is probably not a critical use case but I experienced the problem with a test (Debian) profile where we had no systemd unit configured. It was done in 2019 and was compiling. Upgrading it since then was causing compile error and we never took the time to understand where it was coming from... I'd say that I don't see a production use case requiring it but it makes profile development harder having something that breaks with a validation error difficult to interpret.

We could may be just make the validation error clearer, testing that unit is defined first rather than having the current error when accessing SELF dict with the unit key... This way we would ensure that there is nothing wrong happening during component execution if it is unhappy with the empty unit dict (but for me it works).

@jouvin
Copy link
Contributor Author

jouvin commented Dec 11, 2024

In fact, error in quattor/template-library-examples#42 demonstrates a valid use case: a server where no explicit service is configured with ncm-systemd (all configured with ncm-chkconfig but running EL7+ that includes components/systemd/legacy/chkconfig (and thus ncm-systemd).

I'm opening a PR fixing it by defining unit property in config.pan.

jouvin added a commit to jouvin/template-library-core that referenced this issue Dec 17, 2024
- Fix ncm-systemd schema validation, see quattor/configuration-modules-core#1787
- Manually ported in this repo to allow test-library CI script to succed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants