Closed yalosev closed 2 months ago
Les't add a warning if there is a file with the executable permissions in the lib directory. I think we need this to prevent accidentally putting a hook in the folder where we ignore it.
The behavior also must be documented in all the docs: shell-operator, addon-operator, and deckhouse module development docs.
So what do we do?
The task was to get rid of many messages in the logs stating that files in the directory do not have permission to run. And it is suggested to simply ignore the lib directory from scanning. In case we need to check that the lib directory contains executable files, we must scan it. And if there are such files, issue a warning.
Maybe then it's better not to ignore the lib directory from scanning. But just not display a warning that the file is not executable?
In this case, our system behavior will remain the same, but there will be less spam in the logs.
We just need to remove this warning.
Maybe it would be better to use something like that:
if !IsFileExecutable(f) && !strings.Contains(f.Name(), "/lib/") {
log.Warnf("File '%s' is skipped: no executable permissions, chmod +x is required to run this hook", path)
return nil
}
Hook spams like this:
We can patch this function to ignore the
lib
directory with hooks