Description of problem: When attempting to set up a drift definition for monitoring an application on Windows, the UI does not allow the user to enter a path which contains a parenthesis. Version-Release number of selected component (if applicable): 3.1.0.Beta1 How reproducible: Always Steps to Reproduce: 1. Install JON system 2. Create a test directory that contains a parenthesis cd ${TESTENV_DIR} mkdir -p "Program Files (x86)"/test/for/drift 3. Add some files to the test directory cd ${TESTENV_DIR} touch "Program Files (x86)"/test/for/drift/file01.txt touch "Program Files (x86)"/test/for/drift/file02.txt echo "A file with only one line of text" >>"Program Files (x86)"/test/for/drift/file02.txt 4. Start JON system 5. Import platform into inventory 6. Create a **Resource Drift Detection Definition** for the newly imported platform resource 1. Navigate to the platform resource's *Drift > Definitions* tab 2. Click the **New** button 3. Select **Drift Definition Template** `Template-File System` 4. Click **Next** 5. Set the following values: * **Drift Definition Name:** `Path with parenthesis` * **Drift Definition Description:** `Monitor a file system path that contains parenthesis () in its name for drift.` * **Enabled:** `Yes` * **Attached to Template:** `Yes` * **Drift Handling Mode:** `normal`` * **Pinned:** `No` * **Interval:** `90` * **Base Directory:** * **Value Context:** `fileSystem` * **Value Name:** <THE FULL PATH CREATED EARLIER WHICH CONTAINS ( and/or )> * **Includes:** **Leave empty** * **Excludes:** **Leave empty** Please note that this fails due to the bug. The **Base Directory/Value Name** value will show as invalid due to the `(` and/or `)` To workaround this bug: * **Base Directory:** * **Value Context:** `fileSystem` * **Value Name:** <THE ROOT PATH UP TO THE DIRECTORY THAT CONTAINS THE ( and/or )> * **Includes:** * **Path:** `.` * **Pattern:** `Program Files ?x86?/test/for/drift/**` * **Excludes:** **Leave empty** 6. Click **Finish** Actual results: Unable to complete step 6.6. because **Base Directory > Value Name** reports "Invalid Value" Expected results: The Drift Detection Definition should have been saved and a snapshot properly created. Additional info: This affects other valid file system characters as well. Parenthesis is a pretty bad offender though because Windows systems use (x86) in file paths to denote 32-bit versions of applications and libraries: C:\Program Files (x86)\... C:\Windows\System (x86)\... C:\Windows (x86)\...
Fixed in upstream, waiting for branch to cherry-pick.
Release/jon3.1.x commit: 081742ba378fd3d8d0e9e3942faed49210fedd9d - Add support for Windows allowance of parentheses in directory names. - Add support for more flexible specification of the drift base directory in a Drift Filter. - Add relevant tests for new features. Cherry-pick of master db072ef663ee9d9e276971e1cce9021e26cafef5
A second commit for this one as well: Release/jon3.1.x commit: b0e59ada3a18169b3a1a6802ec4c9516364090f9 There were two ways to go here. One was to add special case handling for the various filter paths that equate to ".". The other was to normalize in the Filter constructor. Since I tried option 1 and missed a spot in my first try to fix it, I've now opted for option 2. The downside is only that what the user types may get normalized to ".". But I added some more description text to state as much. Also, existing Filter paths using "/" or "./" will need to be updated to "." manually, but I doubt there are any out there currently since it wasn't working. Conflicts: modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/FilterFileVisitorTest.java Cherry-pick of master commit: 00ea14c228bd08d6572d0f17ef8040e447b9a0dd
Note, these cherry picked commits also fix bug 827647 - Relative path for Drift Detections Definition Include/Excludes Path does not handle relative path alias or trailing file separator correctly. The work was done together so even though 827647 was not triaged for 3.1.1 it was easier to take the fixes for both.
JON 3.1.1 ER1 build is available. Moving to ON_QA. https://brewweb.devel.redhat.com/buildinfo?buildID=226942
Verified on Version: 3.1.1.ER3 (Build Number: 37108ca:67c6de8) Verified by following the steps. The Drift Detection Definition with Base Directory filesystem path containing a parenthesis is saved and a snapshot is created.