Red Hat Bugzilla – Bug 534463
RHQ_AGENT_DEBUG / RHQ_SERVER_DEBUG should allow for "false" value
Last modified: 2009-01-05 10:13:00 EST
This has always bugged me. RHQ_AGENT_DEBUG and RHQ_SERVER_DEBUG today can be any value - as long as its set to something, debug is enabled. To turn debug off, that env var must not be set at all. So, "RHQ_AGENT_DEBUG=false" actually turned on debug mode because as long as that variable is set to something, debug mode is turned on.
This causes some issues with maintaining the env scripts and the running environment of the agent and server, especially when you want that variable set all the time. I want to be able to always have that env var set - and its value determines whether or not debug mode is on.
To maintain backwards compatibility, I will still allow this var to have any value to enable debug mode - however, the value of "false" is to be the exception now. If you set this value to "false", debug mode will not be turned on. So, these turn debug mode on:
These turn debug mode off:
The above holds true for the RHQ_SERVER_DEBUG variable too.
I had rhq-server.sh and rhq-agent-wrapper.sh reverse the meaning of the debug var. fixed in 2350.
'1' will turn debug on, but '0' won't turn it off?
I think I understand the purpose of using nearly any $value for RHQ_AGENT_DEBUG, but if we're going to implicitly allow '1', should '0' mean the opposite?
Otherwise, these appear to work correctly..
Trying to keep it as backward compatible as possible.
Before, setting this to "1" had no special meaning. That's because before, if the value was ANYTHING, debug was enabled. "1" was the same as "0" which was the same as "foo". As long as the variable was set, debug was enabled.
Now, almost the same thing is still true. Setting the variable to "1" is the same as setting it to "true" is the same as setting it to "0" is the same as setting it to "foo" (this is backward compatible to the old script).
The only difference now is if the value is "false", that explicitly does not turn on debug.
So, the only way this breaks backward compatibility is if a user previously did this to enable debug mode:
But I doubt anyone was doing that to actually turn on debug mode :)
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1257