-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Apache2 reload doesn't seem to work #12880
Comments
Thanks for the report. We'll investigate this. |
I'm having a similar problem with my uwsgi service state, which is probably due to the same issue with
I am able to work around it for now by adding this to my dependency state:
Of course, I'd rather use I'm on Ubuntu 14.04. |
The docs seem pretty clear on this, at least to me. By default if a service is triggered to refresh due to a watch statement the service is by default restarted. If the desired behaviour is to reload the service, then set the reload value to True:
So, this does seem a bit more like a feature request than a bug. @stevage, what is the desired functionality? Is it to reload the service whenever the state is run, if |
@audreyr, your issue seems to be a simple misconfiguration, and doesn't at all appear to be related as you are trying to do a service restart, not a reload. Try replacing
A watch requisite acts just like a require, but with one added step: if the state module has a |
Yeah, interesting - when I read this before, I didn't see the implied link between the first and second sentence. I just read it as "If you want to reload the service, set reload=True". This might be clearer (and more skim-friendly): "To trigger a service restart in response to another change, use a watch statement. Set reload=True to reload rather than restart."
Yes. (I had assumed, incorrectly, that there was also a "restart: True" option.) I don't know if there's a compelling use case, but basically I don't use watch statements much if the cost of re-running the state is low. I find they quickly add a lot of complexity and an additional thing to debug. The cost of reloading Apache for my server was low, so it didn't occur to me to use a watch statement. |
OK. To be honest, the amount of work done to check watch requisites is not that bad. And the purpose of the state.running state is to check if it is running and, if not, to start it, optionally enabling it to start at boot, so there's not often much of a call to restart/reload a service. The reason we have the reload functionality enabled for watch requisites is that a common use case is reloading a service when a config file changes. So a service.running state can watch for changes in a file.managed state and then reload the service. Having said that though, I see no reason why we can't support a reload (and even restart) flag, so long as it is well-documented that the action will be taken EVERY time the state is executed. Perhaps the docs are clearer to me because I am constantly buried in them. I'll try to make them more clear for those new to Salt (or just skimming 😄). |
Is there a way to force reloads even if the service is running, without a watch, using state and not the module? Or is using the module the right way to do this? |
The module is the right way to do this. A forced reload is not very stateful, so it doesn't really fit into the paradigm of state modules. Note that you can use module.run to integrate it into a state run. |
@basepi, thank you! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
My state, running on Ubuntu Quantal:
generates this output:
(And fails to reload the server.)
It's not a question of the init script not supporting reload, as this works just fine:
The text was updated successfully, but these errors were encountered: