You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, when I use __file to put config files onto the target, I want to run a tool/script to check if the contents of the file are valid before reloading the service using the config and possibly breaking it.
Currently, it is possible to trigger a service reload conditionally using --onchange 'checkconf && service reload'.
However, checkconf is only executed after the config file was copied to the target.
The service will not be reloaded immediately, but the service will likely fail to come up on the next reboot at the latest.
So my idea would be to add a --prechange parameter to __file which, if set, makes the __file type only copy the file to the destination if the command given in --prechange exits with status 0.
I'm not sure about %s yet. Complex commands may have to use the path multiple times, or some services might not have the possibility to use an arbitrary path to check.
Maybe a "try or undo" logic would need to be implemented.
The text was updated successfully, but these errors were encountered:
Sometimes, when I use
__file
to put config files onto the target, I want to run a tool/script to check if the contents of the file are valid before reloading the service using the config and possibly breaking it.Currently, it is possible to trigger a service reload conditionally using
--onchange 'checkconf && service reload'
.However,
checkconf
is only executed after the config file was copied to the target.The service will not be reloaded immediately, but the service will likely fail to come up on the next reboot at the latest.
So my idea would be to add a
--prechange
parameter to__file
which, if set, makes the__file
type only copy the file to the destination if the command given in--prechange
exits with status0
.Example use case:
I'm not sure about
%s
yet. Complex commands may have to use the path multiple times, or some services might not have the possibility to use an arbitrary path to check.Maybe a "try or undo" logic would need to be implemented.
The text was updated successfully, but these errors were encountered: