forked from MiamiOH/puppet-httpproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.pp
More file actions
42 lines (38 loc) · 1.49 KB
/
init.pp
File metadata and controls
42 lines (38 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# init.pp
# Manages http proxies for various software
# Defines the httpproxy class. Sets the $http_proxy and $http_proxy_port variable to null.
class httpproxy (
Optional[Stdlib::Host] $http_proxy = undef,
Optional[Stdlib::Port] $http_proxy_port = undef,
$no_proxy = undef,
$profiled = true,
$packagemanager = true,
$systemd = true,
$wget = false,
Boolean $purge_apt_conf = false,
){
# Checks if $http_proxy contains a string. If $http_proxy is null $ensure is set to absent.
# If $http_proxy contains a string then $ensure is set to present.
$ensure = $http_proxy ? {
undef => 'absent',
default => 'present',
}
# Checks if $http_proxy_port contains a string. If $http_proxy_port is null, $proxy_port_string
# is set to null. Otherwise, a colon is added in front of $http_proxy_port and stored in
# $proxy_port_string
$proxy_port_string = $http_proxy_port ? {
undef => undef,
default => ":${http_proxy_port}",
}
# Checks if $http_proxy contains a string. If it is null, $proxy_uri is set to null.
# Otherwise, it will concatenate $http_proxy and $proxy_port_string.
$proxy_uri = $http_proxy ? {
undef => undef,
default => "http://${http_proxy}${proxy_port_string}",
}
# Boolean parameter for class selection
if $profiled { contain 'httpproxy::profiled' }
if $packagemanager { contain 'httpproxy::packagemanager' }
if $systemd { contain 'httpproxy::systemd' }
if $wget { contain 'httpproxy::wget' }
}