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: ensure unit property is defined #1788

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

jouvin
Copy link
Contributor

@jouvin jouvin commented Dec 11, 2024

Fixes #1787

@jouvin jouvin added this to the 25.next milestone Dec 11, 2024
@jrha
Copy link
Member

jrha commented Dec 11, 2024

Isn't the issue here that the schema marks it as optional, but the validation requires it to be present?

@jrha
Copy link
Member

jrha commented Dec 11, 2024

How about jrha@1abc38d instead?

@jouvin
Copy link
Contributor Author

jouvin commented Dec 12, 2024

@jrha I'm happy with your patch too, it should have the same effect for the use case I want to address. I think the main choice criteria between both approaches is whether the configuration module code can deal properly with an undefined unit property. Looking quickly at the code, I have the feeling that the code is not really prepared to deal with no units at all being defined but the actual unit list is built in Systemd/Service.pm by gather_configured_units() which merges systemd units and services defined in ncm-chkconfig so the risk of an empty unit list looks very small and will probably not match a meaningful usecase... So probably it doesn't make a big difference.

@jouvin jouvin force-pushed the systemd_undefined_unit branch 3 times, most recently from fa787fa to f68cf55 Compare December 12, 2024 18:21
@jouvin
Copy link
Contributor Author

jouvin commented Dec 12, 2024

@jrha I replaced my fix by yours. Looks OK. I checked the code in Systemd/Service.pm: gather_configured_units() calls _get_tree() which properly checks the existence of the path so keeping unit undefined should not cause any problem.

@jrha jrha force-pushed the systemd_undefined_unit branch from f68cf55 to 6ee9ea9 Compare December 16, 2024 14:52
@jouvin
Copy link
Contributor Author

jouvin commented Dec 17, 2024

@jrha please, could you merge this PR is you agree with as it would allow to fix errors in several other PRs currently open...

@jrha jrha merged commit 097d030 into quattor:main Dec 17, 2024
3 checks passed
@jrha
Copy link
Member

jrha commented Dec 17, 2024

Sorry, was waiting for the tests to finish and got distracted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

ncm-systemd 24.10.0: validation fails if no unit is defined
3 participants