-
-
Notifications
You must be signed in to change notification settings - Fork 881
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
A negative configtest should be reported as a fail/error #722
Comments
This works as expected for me with:
Puppet fails with:
When testing / debugging, keep in mind that puppet only triggers refresh if resources change. so you need to do a change before every puppet run. |
@ThomasLohner This is an error thrown by the agent on the node, won't be visible in Puppet DB. |
An extra benefit of splitting those steps into resources would be to insert in between if needed a cache clean up which might be needed by some people. if $nginx::config::clean_cache_on_restart {
Exec{ 'cache_clean_up':
before => Service['nginx'],
command => "rm -fr ${nginx::config::proxy_cache_path}",
path => '/bin',
refreshonly => true,
subscribe => Exec['configtest']
}
} |
This makes some sense to me, @tux-o-matic: is this still something you're interested in (and if so, are you willing to contribute a PR and / or help test)? Is it possible to "trap" the service failure from the puppet run rather than actually making an exec call to Honestly, I have no idea how this is working at all:
With some custom modules written in-house (with a different config management system), we used to have a thing where the webserver actually wouldn't restart either if the config was bad. That would be kind of cool (if there was an option not to do the service reload if Puppet notices a config failure), but probably not easy to implement in this module, and could result in unpredictable behavior. |
Ah, got it, only overriding Service if $configtest is true, which it isn't by default. That stuff is clearly totally broken 😭😭😭, which doesn't help with this ticket, but the $configtest parameter and the code related to it should probably be ripped out and simplified. |
The point of this issue is to ensure that any failed config test gets properly reported all the way up to PuppetDB. And hiding configtest within Ruby code or within the 'reload' function of the service script might not guarantee this level of reporting. |
The If someone wants to make a PR to add a (separate) nginx configtest call, and report failures, I can see some value in that, but for now, I'm going to close this issue. |
As long as configtest is not an Exec resource called before a Service resource meant to restart Nginx, you won't have proper reporting. |
Today a broken configuration can go unnoticed, even with 'configtest' enabled unless you go check /var/log/messages on the Nginx node.
The Puppet module should be able to handle 'configtest' as an Exec resource which failure can be reported on the Puppet master.
The text was updated successfully, but these errors were encountered: