Improve Error/Debug Log messaging
I'm trying to get a DHCP smart proxy configured on RHEL 6, but the default error message is practically useless. The error message I'm seeing is "Unable to find the DHCP configuration or lease files". It would be beneficial if all such error messages displayed the path which the program is attempting to access. As an end user/consultant this is beyond frustrating when I need to go back and forth to configuration files trying to figure out exactly where a program is looking.
#1 Updated by Andrew N over 6 years ago
Turns out issue was related to permissions. Perhaps it would be useful to break up configuration and access checks into two pieces rather than do them all in one line. This way you can error if a configuration value is not set, or error if a file cannot be accessed and give a better clue to the end user about where the error is.
#3 Updated by Lukas Zapletal over 6 years ago
all our error messages should have got error codes and these are explained here:
If an error message does not have the ERF code, it's a bug that must be fixed.
Please help us to maintain the wiki page with descriptions of the possible solutions.
#5 Updated by Andrew N over 6 years ago
I think setting the scope to only DHCP proxy misses the point of what I opened the bug for. The intent was to help ensure ALL logging/error messages were more useful I cited the DHCP proxy as the example. The main issue in my example was this piece of code:
unless SETTINGS.dhcp_config and SETTINGS.dhcp_leases \ and File.exist?(SETTINGS.dhcp_config) and File.exist?(SETTINGS.dhcp_leases)
First it would have been most beneficial to split this into two tests, the first being to ensure the variable is set, if not error on the variable not being set. Next check to see if it is possible to access the file, if not error out and show the paths being attempted.
As an end user of software little is more infuriating than error messages which say there is a problem, but don't give you much clue about where the error is.
Again, if you leave the scope to just DHCP and proxy, I feel the point of the ticket will have been lost. However if there is a better way I should have gone about it then please educate me.
#6 Updated by Dominic Cleal over 6 years ago
Setting the category of a bug isn't to say we'll only fix the DHCP module, we'll likely check for other occurrences in the same codebase when it's fixed. It helps us and others find the ticket again quickly. Occurrences in other projects will likely need another ticket if they exist.
#7 Updated by Dmitri Dolguikh about 5 years ago
- Status changed from New to Feedback
This has been addressed in puppet module already, and has been proposed for dhcp module (please see https://github.com/theforeman/smart-proxy/pull/312/files#diff-7eba85f83acfe19a0941d95aee92988eR10). The general idea is to verify during startup that files necessary for module to function are accessible. In case there were problems accessing config or lease files, log the issues and disable the module.