So I think I've found out why - it's not a bug at all, but down to the
regular expression CQ sets for the filter, which for author mode is
".*/(install|config)(.author)?$" (and I assume is
".*/(install|config)(.publish)?$" for publish).

So that accounts for the fact that /config.author.dev is not the same as
/config.dev.author.

In that case I think we should settle on the naming convention of
config.<what>.<ever>.<we>.<want>.(install|config) to make sure it
behaves as we expect.

Jon.


On Tue, May 15, 2012, at 10:35 AM, Jon Barber wrote:
> Hi,
> 
> We're using CQ 5.4 which in turn is using Sling & the
> org.apache.sling.installer.provider.jcr bundle version 3.0.4, and I'm
> seeing some behaviour which may be a bug, but may be a misunderstanding
> on my part. I've been experimenting with environment configuration as
> per
> http://www.pro-vision.de/adaptto/downloads/2011_lightning_Runmodes_and_Configs_for_Fun_and_Profit.pdf
> and http://sling.apache.org/site/jcr-installer-provider.html.
> 
> I've set extra run modes on the instance I'm running by setting
> -Dsling.run.modes=author,mycompany,dev.
> 
> I've created a sample project that creates the following structure:
> 
> /apps/my-cq-project/runmodes/config.author
> /apps/my-cq-project/runmodes/config.author.dev
> /apps/my-cq-project/runmodes/config.author.dev.mycompany
> 
> and I enabled debug log level for
> org.apache.sling.installer.provider.jcr.impl.FolderNameFilter. So this
> is what I see for priorities etc :
> 
> 2012-05-15 09:09:05.342 DEBUG
> [org.apache.sling.installer.provider.jcr.impl.FolderNameFilter]
> getPriority(/apps/my-cq-project/runmodes/config.author)=201
> (prefix=/config, run modes=[author])
> 2012-05-15 09:09:05.343 DEBUG
> [org.apache.sling.installer.provider.jcr.impl.FolderNameFilter]
> getPriority(/apps/my-cq-project/runmodes/config.author.dev.mycompany)=202
> (prefix=/config.author, run modes=[mycompany, dev])
> 2012-05-15 09:09:05.343 DEBUG
> [org.apache.sling.installer.provider.jcr.impl.FolderNameFilter]
> getPriority(/apps/my-cq-project/runmodes/config.author.dev)=201
> (prefix=/config.author, run modes=[dev])
> 
> So this seems wrong to me, as the folder config.author has the same
> priority as config.author.dev. And indeed, if I delete the config files
> from config.author.dev.mycompany the config in config.author (if
> present) wins over config.author.dev. I'd expect config.author.dev to
> win as it has more of the run modes present in the name. It looks like
> the bug may be present in the code that works out the prefix, as it
> differs as you can see.
> 
> Additionally, if I create a new folder with the name
> config.mycompany.author.dev I see :
> 
> 2012-05-15 09:31:00.162 DEBUG
> [org.apache.sling.installer.provider.jcr.impl.FolderNameFilter]
> getPriority(/apps/my-cq-project/runmodes/config.mycompany.author.dev)=203
> (prefix=/config, run modes=[dev, author, mycompany])
> 
> So in theory config.mycompany.author.dev should have the same priority
> as config.author.dev.mycompany but they don't.
> 
> So my questions are :
> 
> 1. Is my understanding wrong, or is it a bug ?
> 2. Given this behaviour what naming convention would you recommend ?
> config.<company>.<environment>.[author|dev] ?
> 
> Thanks,
> 
> Jon.
> 
> 
> 

Reply via email to