Morning all
I'm currently working on a module[1] to support installation and configuration of Apache Karaf[2], a Java OSGi container...
I've got most of the installation piece sorted, and am starting to work on the configuration side of things.
Unfortunately I've hit a bit of a blocker which I'm not sure of the best way to work-around.
As part of the service installation process, a Java wrapper config file is created.
This config file needs to be modified to specify the 'JAVA_HOME' value. However I'm not sure of the best way to calculate this JAVA_HOME value, due to the variable nature of both Java variants (Java 6 vs 7, Oracle vs OpenJDK, release version) and the fact that Java might not be installed at the start of the Puppet run.
The intention is to use a template for the config file, so it's modifiable by Puppet.
Options I can think of:
- Use a fact to provide JAVA_HOME. This fails if Java isn't installed at the start of the agent run, which is a valid scenario if this module is also installing Java...
- Hard code the value based on a pre-determined file path based on chosen Java distro and version. Not very clean/configurable...
- Update wrapper config file to pull in system env for JAVA_HOME. However this fails if the system version isn't the one that the app should use...
Am I missing a trick somewhere along the lines, or is hoping to achieve all this - Install Java, Install Karaf, configure Karaf service - in one run asking too much?
Thoughts/ideas welcome.
Cheers
Gavin
[1]
https://github.com/fatmcgav/fatmcgav-karaf/tree/develop[2]
http://karaf.apache.org/index.html