Closed kwin closed 5 months ago
To me it is not clear which code is supposed to create/creating the parent node /var/groovyconsole
in the first place. Any idea @bdhoine or @royteeuwen?
Update: So repoinit itself creates non-existing ancestors with default type (and in case that fails with sling:Folder
): https://github.com/apache/sling-org-apache-sling-jcr-repoinit/blob/41509793b720eac9328bef47c61745d6f94e197b/src/main/java/org/apache/sling/jcr/repoinit/impl/NodeVisitor.java#L182-L186. The real solution is to switch to enforce path
(https://issues.apache.org/jira/browse/SLING-11736). Unfortunately that is not available in AEM 6.5.x. We face a race condition in our packages when we deploy from scratch our all container package which contains both
/var/groovyconsole/customer/script
with no .content.xml
for uncovered ancestor nodeson AEM 6.5.x (still shipping with a very outdated JR FileVault version). In case Groovy Console's OSGi configuration for repoinit kicks in first, everything is fine, but in case our package is installed first /var/groovyconsole
is created as nt:folder
and never modified afterwards. Restarting such an AEM instance leads to the repository not starting fully with the exception message from above.
@kwin didn't even know that create path was deprecated, thanks for that!
This does indeed make it a hard case to fix in AEM 6.5 though... (or any AEM instance where you use an all
package through installation of the package manager, you always get race conditions)
What I could do is rewrite this to BundleActivator
code, this way we can change the primary type of /var/groovyconsole
even in AEM 6.5.
The only other alternative I can think of is putting package dependencies between the config package of aem-groovy-console
and your customer scripts, but even then you aren't certain the OSGi config will actually be executed before installing the depending package :/
Do you have any other suggestions?
I don’t have a good idea either. The proper solution is „enforce path“ but only available in AEMaaCS unfortunately. Maybe the node /var/groovyconsole/audit can be converted to sling:Folder
as that is allowed in the pretty restricted nt:folder
as well. WDYT?
@kwin sorry for the long wait, we had issues with releasing this repo because of GPG issues. This is now released.
FYI, I'm planning to release a version 20.x in the upcoming weeks with the changes from Barry and to upgrade groovy to JDK 22 support (Groovy 4.0.18) and a new feature inspired from Jenkins pipeline libraries where you can do @Library('path/in/crx') to load in extra groovy "snippets" that you'd like to share over multiple groovy files at runtime instead of having to do a code deploy to add extra functionality
Right now in https://github.com/orbinson/aem-groovy-console/blob/main/ui.config/src/main/content/jcr_root/apps/groovyconsole-config/osgiconfig/config/org.apache.sling.jcr.repoinit.RepositoryInitializer-groovyconsole.config you enforce creation of subnodes within /var/groovyconsole which require that to be a lenient type (e.g.
sling:Folder
). If for some reason the node/var/groovyconsole
is of typent:folder
starting the repository fails with the following exception: