(MODULES-2971) Add java_home to all operating systems

This patch adds the java_home variable to all supported
operating systemd, and gives the user the option to
set it themselves. It also updates config.pp to
ensure that the JAVA_HOME variable is set to
the desired java_home.
This commit is contained in:
Nate Potter
2016-07-15 18:19:03 -07:00
parent 71a8bed51d
commit dd8f85a2fa
4 changed files with 136 additions and 22 deletions

View File

@@ -35,6 +35,10 @@
# alternative is actually enabled, this is required to ensure the
# correct JVM is enabled.
#
# [*java_home*]
# The path to where the JRE is installed. This will be set as an
# environment variable.
#
# Actions:
#
# Requires:
@@ -47,7 +51,8 @@ class java(
$package = undef,
$package_options = undef,
$java_alternative = undef,
$java_alternative_path = undef
$java_alternative_path = undef,
$java_home = undef
) {
include java::params
@@ -61,7 +66,7 @@ class java(
$default_package_name = $java::params::java[$distribution]['package']
$default_alternative = $java::params::java[$distribution]['alternative']
$default_alternative_path = $java::params::java[$distribution]['alternative_path']
$java_home = $java::params::java[$distribution]['java_home']
$default_java_home = $java::params::java[$distribution]['java_home']
} else {
fail("Java distribution ${distribution} is not supported.")
}
@@ -91,6 +96,14 @@ class java(
default => $java_alternative_path,
}
$use_java_home = $java_home ? {
undef => $use_java_package_name ? {
$default_package_name => $default_java_home,
default => undef,
},
default => $java_home,
}
$jre_flag = $use_java_package_name ? {
/headless/ => '--jre-headless',
default => '--jre'