Comments on: One Tool to Configure Them All: Sling RepoInit https://blogs.perficient.com/2020/06/17/one-tool-to-configure-them-all-sling-repoinit/ Expert Digital Insights Tue, 01 Dec 2020 19:16:51 +0000 hourly 1 By: Oliver Lietz https://blogs.perficient.com/2020/06/17/one-tool-to-configure-them-all-sling-repoinit/#comment-27749 Mon, 30 Nov 2020 12:19:03 +0000 https://blogs.perficient.com/?p=276009#comment-27749 There is no need to write any code, just use Pax URL Classpath (an OSGi URL handler) to reference (configurations and) repoinit statements.
Since version 2.6.3 Pax URL Classpath is an uber jar and therefore you only have to deploy the pax-url-classpath bundle to make it work.
See also SLING-5930 “Provide repoinit statements as bundle resource” (2016!), SLING-9944 “Bundle configurations and reference via classpath protocol” and https://github.com/apache/sling-org-apache-sling-karaf-configs/commit/a0d41eb84d4d32f88dcf2edfcdbbebf67055030a – plain repoinit statements are much more readable and easier to (re)use.
The proper syntax for factory configs is classpath:[//BundleSymbolicName/]filename.

]]>
By: Nono Junang https://blogs.perficient.com/2020/06/17/one-tool-to-configure-them-all-sling-repoinit/#comment-27396 Wed, 28 Oct 2020 03:24:24 +0000 https://blogs.perficient.com/?p=276009#comment-27396 Hi Dan,
I am trying to use the following syntax raw:classpath://some-repoinit-file.txt as mentioned in the documentation but I get a java.lang.IllegalStateException: Unknown protocol: raw.
Any idea why? Also what is the link to the ticket you have submitted so that I can follow?

Assuming it works, will the init file get executed everytime the bundle containing it is deployed or only once?

Thanks,

]]>
By: krishna https://blogs.perficient.com/2020/06/17/one-tool-to-configure-them-all-sling-repoinit/#comment-26586 Fri, 14 Aug 2020 11:11:57 +0000 https://blogs.perficient.com/?p=276009#comment-26586 I am trying to create groups but dont know why groups are not created via script

]]>
By: Ravi Raj https://blogs.perficient.com/2020/06/17/one-tool-to-configure-them-all-sling-repoinit/#comment-20212 Tue, 21 Jul 2020 19:36:57 +0000 https://blogs.perficient.com/?p=276009#comment-20212 While implementing repoinit there are only two scenarios when these scripts gets executed, given if one does not have access to either crx/de or felix console.(for the case of CI/CD using Jenkins or cloud deployment)
1. If config related to repoinit with scripts in it is not existing, then doing a mvn deployment using ci/cd for first time will add ACL or create group based on whatever is written in script. However it is not adding or updating any ACL in subsequent deployment. (it works only if we manually remove repoinit config from crx/de before next deployment or save script by opening it again in crx/de or felix).
2. If we are restarting the application, then all scripts gets executed and permission gets added. ( effectively after each deployment we need to bounce the application to execute repoinit script)

Because of this limitation, if there is a requirement to update the script with different set of ACL for existing group or user then those permission will not get updated unless we bounce the instance or some one with access to crx/de or admin console goes and manually triggers those config. In both the case admin is required.

Any suggestion on how to overcome this problem.

]]>
By: Dan Klco https://blogs.perficient.com/2020/06/17/one-tool-to-configure-them-all-sling-repoinit/#comment-19825 Mon, 22 Jun 2020 16:36:48 +0000 https://blogs.perficient.com/?p=276009#comment-19825 In reply to Jörg Hoh.

Agreed Jörg, you can do this without any additional code, however, specifying via the script attribute isn’t ideal as you have to inline the RepoInit statements into OSGi configuration which is hard to read / understand.

]]>
By: Jörg Hoh https://blogs.perficient.com/2020/06/17/one-tool-to-configure-them-all-sling-repoinit/#comment-19823 Mon, 22 Jun 2020 16:25:54 +0000 https://blogs.perficient.com/?p=276009#comment-19823 You don’t have to write any code, you can use the field scripts and put your script in there (which works best if you deploy the script).

]]>