Bug 738346 - Negative test for drift configuration with invalid directory produces no error
Summary: Negative test for drift configuration with invalid directory produces no error
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: drift
Version: 4.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: John Sanda
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: 707225
TreeView+ depends on / blocked
 
Reported: 2011-09-14 15:20 UTC by Mike Foley
Modified: 2012-02-07 19:17 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-02-07 19:17:40 UTC
Embargoed:


Attachments (Terms of Use)

Description Mike Foley 2011-09-14 15:20:27 UTC
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

How reproducible:
100%

Steps to Reproduce:
1.  create a file system drift configuration with an invalid directory
2.  change set version #0 is produced.

  
Actual results:
changeset 0 is produced.  no message during configuration or in changesets to indicate the directory is invalid.

Expected results:
error message

Additional info:

Comment 1 John Sanda 2011-09-15 13:50:39 UTC
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.

Comment 2 John Sanda 2011-10-17 15:02:02 UTC
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.

Comment 3 John Sanda 2011-10-17 19:49:58 UTC
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

Comment 4 Mike Foley 2011-10-18 15:26:33 UTC
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.

Comment 5 Mike Foley 2011-10-18 15:27:31 UTC
To be clear ... there are no change sets ... initial or otherwise ... at all ... so there are no warning messages.

Comment 6 John Sanda 2011-10-31 13:29:29 UTC
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.

Comment 7 Mike Foley 2011-10-31 20:43:19 UTC
documenting that there is some feedback in the logs in this negative test scenario

easurement collection for [6] 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

Comment 8 Mike Foley 2012-02-07 19:17:40 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE


Note You need to log in before you can comment on or make changes to this bug.