Skip to content

Commit bdfc8f2

Browse files
committed
#481 Adding documentation on how to apply yaml files directly (ad hoc)
Closes #481
1 parent 7e6f450 commit bdfc8f2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/ApplyConfig.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,31 @@ NOTE: Usually it is better to rely on the install hook and manual executions via
141141
The upload listener service requires the `AC Tool Installation Service` (PID `biz.netcentric.cq.tools.actool.impl.AcInstallationServiceImpl`) to be configured correctly, i.e. its configuration path must point to the nodes containing the `YAML` files.
142142
<img src="images/installation-service.png">
143143

144+
### Ad hoc installation of small fragments
145+
146+
Generally it is best practice to keep the yaml files in source control and only use one of the above methods to trigger the installation of those files.
147+
However for some support scenarios it can be useful to be able to apply small yaml fragments directly. This can be achieved by using the following
148+
groovy script (using the [AEM Groovy Console](https://github.com/icfnext/aem-groovy-console)):
149+
150+
```
151+
import static org.apache.jackrabbit.commons.JcrUtils.*
152+
import static org.apache.commons.io.IOUtils.*
153+
import biz.netcentric.cq.tools.actool.api.AcInstallationService
154+
def runAcTool(adhocFolder, adhocFile, yaml) {
155+
putFile(getOrCreateByPath(adhocFolder, "nt:folder", session), adhocFile, "text/yaml", toInputStream(yaml)); session.save();
156+
return getService(AcInstallationService.class).apply(adhocFolder)
157+
}
158+
159+
runAcTool("/tmp/actool-adhoc", "actool.yaml", """
160+
161+
- user_config:
162+
- test-user:
163+
- name: "My test user"
164+
path: /home/users/testusers
165+
166+
""")
167+
```
168+
169+
As for any executions, the log of ad hoc installations are found underneath `/var/statistics/achistory`.
144170

145171

0 commit comments

Comments
 (0)