-
-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathrepo.pp
65 lines (62 loc) · 1.81 KB
/
repo.pp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# @summary Manage the repos where the ProxySQL package might be.
#
# @api private
class proxysql::repo {
assert_private()
if $proxysql::manage_repo and !$proxysql::package_source {
$repo = $proxysql::version ? {
/^2\.7\./ => $proxysql::params::repo27,
/^2\.6\./ => $proxysql::params::repo26,
/^2\.5\./ => $proxysql::params::repo25,
/^2\.4\./ => $proxysql::params::repo24,
/^2\.3\./ => $proxysql::params::repo23,
/^2\.2\./ => $proxysql::params::repo22,
default => fail("Unsupported `proxysql::version` ${proxysql::version}")
}
case $facts['os']['family'] {
'Debian': {
apt::source { 'proxysql_repo':
* => $repo,
}
Class['apt::update'] -> Package[$proxysql::package_name]
}
'RedHat': {
yumrepo { $repo['name']:
* => $repo,
}
# Purge old/unnecessary repos.
if ($proxysql::version !~ /^2\.6\./) {
yumrepo { $proxysql::params::repo26['name']:
ensure => absent,
}
}
if ($proxysql::version !~ /^2\.5\./) {
yumrepo { $proxysql::params::repo25['name']:
ensure => absent,
}
}
if ($proxysql::version !~ /^2\.4\./) {
yumrepo { $proxysql::params::repo24['name']:
ensure => absent,
}
}
if ($proxysql::version !~ /^2\.3\./) {
yumrepo { $proxysql::params::repo23['name']:
ensure => absent,
}
}
if ($proxysql::version !~ /^2\.2\./) {
yumrepo { $proxysql::params::repo22['name']:
ensure => absent,
}
}
yumrepo { 'proxysql_repo':
ensure => absent,
}
}
default: {
fail('This operatingsystem is not supported (yet).')
}
}
}
}