Skip to content

Commit 29d10d5

Browse files
authored
Merge pull request #531 from Netcentric/feature/#481-documentation-on-how-to-adhoc-apply-yaml-fragments
#481 Adding documentation on how to apply yaml files directly (ad hoc)
2 parents 291bde6 + 93ea17b commit 29d10d5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/ApplyConfig.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [JMX](#jmx)
1010
* [Startup Hook](#startup-hook)
1111
* [Upload Listener Service](#upload-listener-service)
12+
* [Ad hoc installation of small fragments](#ad-hoc-installation-of-small-fragments)
1213

1314
<!--- This table of contents has been generated with https://github.com/ekalinin/github-markdown-toc#gh-md-toc -->
1415

@@ -141,5 +142,31 @@ NOTE: Usually it is better to rely on the install hook and manual executions via
141142
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.
142143
<img src="images/installation-service.png">
143144

145+
### Ad hoc installation of small fragments
146+
147+
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.
148+
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
149+
groovy script (using the [AEM Groovy Console](https://github.com/icfnext/aem-groovy-console)):
150+
151+
```
152+
import static org.apache.jackrabbit.commons.JcrUtils.*
153+
import static org.apache.commons.io.IOUtils.*
154+
import biz.netcentric.cq.tools.actool.api.AcInstallationService
155+
def runAcTool(adhocFolder, adhocFile, yaml) {
156+
putFile(getOrCreateByPath(adhocFolder, "nt:folder", session), adhocFile, "text/yaml", toInputStream(yaml)); session.save();
157+
return getService(AcInstallationService.class).apply(adhocFolder)
158+
}
159+
160+
runAcTool("/tmp/actool-adhoc", "actool.yaml", """
161+
162+
- user_config:
163+
- test-user:
164+
- name: "My test user"
165+
path: /home/users/testusers
166+
167+
""")
168+
```
169+
170+
As for any executions, the log of ad hoc installations are found underneath `/var/statistics/achistory`.
144171

145172

0 commit comments

Comments
 (0)