Red Hat Bugzilla – Bug 738346
Negative test for drift configuration with invalid directory produces no error
Last modified: 2012-02-07 14:17:40 EST
Description of problem:Negative test for drift configuration with invalid directory produces no error
Version-Release number of selected component (if applicable):
RHQ 4.1 09/14/2011 build
Steps to Reproduce:
1. create a file system drift configuration with an invalid directory
2. change set version #0 is produced.
changeset 0 is produced. no message during configuration or in changesets to indicate the directory is invalid.
This issue has come up and been discussed some already. I think that there is some overlap with usability. If you create a drift detection definition (drift configuration in old terminology) that has non-existent base directory, then the definition is invalid. As things are currently implemented we fail silently and never inform the user that the the drift detection definition is invalid.
I think that the solution for this needs to involve doing some up front validation when the drift detection definition is getting created. The server can call the agent to verify that the base directory actually exists. If it does not exist, the UI should display a error message to the user.
For the base directory you can choose between a plugin configuration property, a resource configuration property, a measurement trait, or a file system path. If you choose something other than file system path, the editor does not provide anything to show you what valid values are. If you do not already you know the plugin configuration property names for example, then you may have to resort to looking at the plugin descriptor to get the property names. A much more user friendly approach would be to display a list of possible plugin configuration properties.
The issue here is that the base directory as specified does not exist when the drift definition is created. The agent currently does not handle this scenario. The non-existent base directory could be due to a typo or it could be intentional where the user knows that the directory does not exist and wants to be informed when/if content is added in that directory.
Since we cannot determine the reason for the missing base directory, I will have the agent log a warning message that the directory does not exist. And if/when the directory is created (with some content in it), it will be reported as drift. Similarly, if the base directory is deleted, it will be reported as drift as well.
Slight change of plan from my previous comment. The agent will log a detailed warning message and will still report an empty initial change set. If the base directory is deleted after the initial change set has been reported, it is treated as regular drift. That is, if there were files in the base directory, then the agent reports their deletion as drift. The agent will also log another warning indicating that the base directory has been deleted.
commit hash: 50c00fc0af74da28ac4cf0c203ee5e862f2a4e3b
There are only 2 Drift menu items ... "Definitions" and "History". For the negative testcase here... nothing shows up in History. There are no warning messages that I see. It is impossible for me to verify the negative test case here with the RHQ 10/18/2011 build.
To be clear ... there are no change sets ... initial or otherwise ... at all ... so there are no warning messages.
Mike, can you retest this? The history tab no longer exists and the warning message is logged by the agent. That is, a log message with severity of WARN is written to the agent.log file. Here is a snippet from my agent.log file to show what you are looking for,
(rhq.core.pc.drift.DriftDetector)- Processing DriftDetectionSchedule[resourceId: 10001, driftDefinitionId: 0, driftDefinitionName: No Base Dir]
2011-10-31 09:30:25,873 WARN [pool-3-thread-2] (rhq.core.pc.drift.DriftDetector)- The base directory [/home/jsanda/DOES_NOT_EXIST] for DriftDetectionSchedule[resourceId: 10001, driftDefinitionId: 0, driftDefinitionName: No Base Dir] does not exist. You may want review the drift definition and verify that the value of the base directory is in fact correct.
documenting that there is some feedback in the logs in this negative test scenario
easurement collection for  metrics took 5ms - sending report to Server...
2011-10-31 16:41:53,871 WARN [pool-3-thread-3] (rhq.core.pc.drift.DriftDetector)- The base directory [/xxxxxxxxxxxxxxxxxxxxx] for DriftDetectionSchedule[resourceId: 10001, driftDefinitionId: 0, driftDefinitionName: bogus] does not exist. You may want review the drift definition and verify that the value of the base directory is in fact correc
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE