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

Commit 8eccd80

Browse files
committed
Add proxy support via class parameters
* proxy_server * proxy_type Closes #29
1 parent 1b16289 commit 8eccd80

File tree

4 files changed

+49
-18
lines changed

4 files changed

+49
-18
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ class { 'oracle_java':
9292
}
9393
```
9494

95+
Download Java archives behind a proxy server
96+
97+
```puppet
98+
class { 'oracle_java':
99+
100+
proxy_server => 'http://user:[email protected]:8080'
101+
}
102+
```
103+
95104
##Usage
96105

97106
###Classes and Defined Types
@@ -139,6 +148,14 @@ Do not download the Oracle Java archive from Oracle servers, instead use an alte
139148

140149
Custom MD5 checksum used to verify the archive integrity. Optional. Defaults to the checksum provided by Oracle
141150

151+
#####`proxy_server`
152+
153+
URL of a proxy server used for downloading Java archives
154+
155+
#####`proxy_type`
156+
157+
Type of the proxy server. Valid values are `none`, `http`, `https` and `ftp`. Optional. Default determined by the scheme used in `proxy_server`
158+
142159
####Define: `oracle_java::installation`
143160

144161
Installs an extra version of Oracle Java in `install_path`

manifests/download.pp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
group => 'root'
2222
}
2323

24+
Archive {
25+
cookie => 'oraclelicense=accept-securebackup-cookie',
26+
source => $oracle_java::downloadurl,
27+
proxy_server => $oracle_java::proxy_server,
28+
proxy_type => $oracle_java::proxy_type,
29+
require => File[$oracle_java::install_path]
30+
}
31+
2432
# with checksum check
2533
if $oracle_java::check_checksum {
2634
include oracle_java::checksums # get checksums list
@@ -33,20 +41,13 @@
3341
# download archive
3442
if $oracle_java::format_real == 'rpm' or $oracle_java::maj_version == '6' {
3543
archive { "${oracle_java::install_path}/${oracle_java::filename}":
36-
#provider => 'curl',
37-
cookie => 'oraclelicense=accept-securebackup-cookie',
38-
source => $oracle_java::downloadurl,
3944
cleanup => false,
40-
require => File[$oracle_java::install_path]
45+
extract => false
4146
}
4247
} else {
4348
# also extract and clean up if tar.gz
4449
archive { "${oracle_java::install_path}/${oracle_java::filename}":
45-
#provider => 'curl',
46-
cookie => 'oraclelicense=accept-securebackup-cookie',
47-
source => $oracle_java::downloadurl,
4850
cleanup => true,
49-
require => File[$oracle_java::install_path],
5051
extract => true,
5152
extract_path => $oracle_java::install_path,
5253
creates => "${oracle_java::install_path}/${oracle_java::longversion}"

manifests/init.pp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
# fetch the package from an alternative URL
2323
# [*custom_checksum*]
2424
# use a custom checksum to verify the archive integrity
25+
# [*proxy_server*]
26+
# proxy server url
27+
# [*proxy_type*]
28+
# proxy server type (valid: 'none'|'http'|'https'|'ftp')
2529
#
2630
# === Actions:
2731
#
@@ -50,7 +54,9 @@
5054
$add_system_env = false,
5155
$install_path = '/usr/java',
5256
$custom_download_url = undef,
53-
$custom_checksum = undef
57+
$custom_checksum = undef,
58+
$proxy_server = undef,
59+
$proxy_type = undef
5460
) {
5561
if !$format {
5662
if $::osfamily =~ /RedHat|Suse/ or $::operatingsystem == 'Mageia' {

manifests/installation.pp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
# fetch the package from an alternative URL
1717
# [*custom_checksum*]
1818
# use a custom checksum to verify the archive integrity
19+
# [*proxy_server*]
20+
# proxy server url
21+
# [*proxy_type*]
22+
# proxy server type (valid: 'none'|'http'|'https'|'ftp')
1923
#
2024
# === Actions:
2125
#
@@ -38,7 +42,9 @@
3842
$check_checksum = true,
3943
$add_alternative = false,
4044
$custom_download_url = undef,
41-
$custom_checksum = undef
45+
$custom_checksum = undef,
46+
$proxy_server = undef,
47+
$proxy_type = undef
4248
) {
4349

4450
# The base class must be included first
@@ -460,23 +466,24 @@
460466
}
461467
}
462468

469+
Archive {
470+
cookie => 'oraclelicense=accept-securebackup-cookie',
471+
source => $downloadurl,
472+
proxy_server => $proxy_server,
473+
proxy_type => $proxy_type,
474+
require => File[$install_path]
475+
}
476+
463477
# download archive
464478
if $maj_version == '6' {
465479
archive { "${install_path}/${filename}":
466-
#provider => 'curl',
467-
cookie => 'oraclelicense=accept-securebackup-cookie',
468-
source => $downloadurl,
469480
cleanup => false,
470-
require => File[$install_path]
481+
extract => false
471482
}
472483
} else {
473484
# also extract and clean up if tar.gz
474485
archive { "${install_path}/${filename}":
475-
#provider => 'curl',
476-
cookie => 'oraclelicense=accept-securebackup-cookie',
477-
source => $downloadurl,
478486
cleanup => true,
479-
require => File[$install_path],
480487
extract => true,
481488
extract_path => $install_path,
482489
creates => "${install_path}/${longversion}"

0 commit comments

Comments
 (0)