Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit a43975a

Browse files
committed
Add param validation for install_path and fallback to tar.gz
1 parent 6b6836d commit a43975a

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ oracle_java::installation { '7u65':
7777
}
7878
```
7979

80-
Force installation from standard tar.gz archive and in a custom location
80+
Force installation from standard tar.gz archive, in a custom location
8181

8282
```puppet
8383
class { 'oracle_java':
@@ -138,7 +138,7 @@ Add `JAVA_HOME` environment variable to the `/etc/environment` file. Boolean val
138138

139139
#####`custom_download_url`
140140

141-
Do not download the Oracle Java archive from Oracle servers, instead use an alternative URL (example: `http://repo.mycompany.com/jdk-8u66-linux-x64.tar.gz`). Requires `format` set to `tar.gz`
141+
Do not download the Oracle Java archive from Oracle servers, instead use an alternative URL (example: `http://myrepo.com/jdk-8u66-linux-x64.tar.gz`)
142142

143143
#####`custom_checksum`
144144

manifests/checksums.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
fail('You must include the oracle_java base class before using any oracle_java sub class')
99
}
1010

11-
if $oracle_java::custom_checksum == undef {
11+
if !$oracle_java::custom_checksum {
1212
case $oracle_java::filename {
1313
# 8u66
1414
'jdk-8u66-linux-i586.rpm' : { $checksum = 'a35792c4d9ae325404148b90ce632076' }

manifests/init.pp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# [*add_system_env*]
2020
# add system-wide Java environment variables (boolean)
2121
# [*custom_download_url*]
22-
# fetch the package from an alternative URL. Requires 'tar.gz' format
22+
# fetch the package from an alternative URL
2323
# [*custom_checksum*]
2424
# use a custom checksum to verify the archive integrity
2525
#
@@ -54,9 +54,13 @@
5454
) {
5555
if !$format {
5656
if $::osfamily =~ /RedHat|Suse/ or $::operatingsystem == 'Mageia' {
57-
$format_real = 'rpm'
58-
} else {
59-
$format_real = 'tar.gz'
57+
case $install_path {
58+
'/usr/java' : { $format_real = 'rpm' }
59+
default : {
60+
notice("'install_path' set to custom location on RPM platform, falling back to tar.gz installation")
61+
$format_real = 'tar.gz'
62+
}
63+
}
6064
}
6165
} else {
6266
$format_real = $format
@@ -67,6 +71,7 @@
6771
validate_re($type, '^(jre|jdk)$', '$type must be either \'jre\' or \'jdk\'')
6872
validate_re($format_real, '^(rpm|tar\.gz)$', '$format must be either \'rpm\' or \'tar.gz\'')
6973
validate_bool($check_checksum, $add_alternative)
74+
validate_absolute_path($install_path)
7075

7176
# set to latest release if no minor version was provided
7277
if $version == '8' {

manifests/installation.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
}
147147
}
148148
#-- end javalist --#
149-
if $custom_download_url == undef {
149+
if !$custom_download_url {
150150
$downloadurl = "http://download.oracle.com/otn-pub/java/jdk/${version_final}${build}/${filename}"
151151
} else {
152152
$downloadurl = $custom_download_url
@@ -171,7 +171,7 @@
171171
# with checksum check
172172
if $check_checksum {
173173
#-- start checksum --#
174-
if $custom_checksum == undef {
174+
if !$custom_checksum {
175175
case $filename {
176176
# 8u66
177177
'jdk-8u66-linux-i586.rpm' : { $checksum = 'a35792c4d9ae325404148b90ce632076' }

0 commit comments

Comments
 (0)