I have a package that installs the etc map entries on my Publishers.
I currently have some mapping configs there that are obsolete, but must be removed because they break the new correct mapping.
All my mappings are located underneath /etc/map.example The current rule in the filter.xml is
<filter root="/etc/map.example" mode="replace"/>
so I would expect the whole tree underneath to be wiped and replaced (according to https://jackrabbit.apache.org/filevault/filter.html ), but this is clearly not what happens - I checked in the AEM cloud Publish Repository Browser and the old nodes are still there. Unfortunately the Repo Browser has no option to delete stuff and CRXDE is not available in the cloud on Publish.
The nodes I need to delete are as follows:
/etc/map.example/integration.publish/https/integration.example.com/redirect_old
/etc/map.example/integration.publish/https/integration.example.fr
/etc/map.example/integration.publish/https/integration.example.de
/etc/map.example/integration.publish/https/integration.example.it
where "integration" is the name of my environment and ideally I want to use a wildcard to make this match for all environment mapping configs that also have to be cleaned (but this is nice-to-have).
In addition, how can I ensure that underneath integration.example.com, ONLY the listed "redirect_old" node is removed, but not other nodes that also exist there and/or are added with the same package?
The question is: How would my filter.xml entry look like to actively remove nodes from AEM? (nodes do no longer exist in the package, but still exist in the AEM repository)
Update: I already tried an entry in filter.xml (without any matching content in my package) like this
<filter root="/etc/map.example/integration.publish/https/integration.example.com/redirect_old" mode="replace" type="cleanup"/>
but it did not have any effect at all, the nodes are still there.
I discovered the root cause of the issue. The jackrabbit documentation is actually correct: it only requires the "replace" mode on the parent filter.xml entry, and then the actual child nodes need to be absent in the package - this will remove them.
But there were two issues preventing this:
1.
An obsolete redundant entry in the filter.xml (some historic legacy or default), before/above the /etc/map.example entry:
<filter root="/etc" mode="merge"/>
this prevented the replace, because the effective mode was "merge" instead, which does not touch existing nodes in the repo. So it had to be removed.
2.
Some of the intermediate folder nodes had a .content.xml in the package which did not explicitly list the child folders, e.g. at theĀ
/etc/map.example
and
/etc/map.example/integration.publish
levels.
The explicit listing of child folder nodes seems to be necessary to cause the "replace" mode to actually remove all children that are not present in the package.
Once this is done, the filters work exactly as documented in Jackrabbit