Skip to content

Commit

Permalink
Merge pull request #887 from voxpupuli/ol-fixes
Browse files Browse the repository at this point in the history
OracleLinux fixes
  • Loading branch information
evgeni authored Oct 4, 2023
2 parents 085c715 + 14ef143 commit f22bc00
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 53 deletions.
2 changes: 1 addition & 1 deletion manifests/database/postgresql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
assert_private()

if ($database_schema_path == false) or ($database_schema_path == '') {
if member(['CentOS', 'RedHat', 'OracleLinux', 'VirtuozzoLinux'], $facts['os']['name']) {
if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7' {
if versioncmp($zabbix_version, '6.0') >= 0 {
$schema_path = '/usr/share/zabbix-sql-scripts/postgresql/'
} else {
Expand Down
31 changes: 5 additions & 26 deletions manifests/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -420,32 +420,11 @@
}
}

# Now we are going to install the correct packages.
case $facts['os']['name'] {
'redhat', 'centos', 'oraclelinux', 'VirtuozzoLinux': {
#There is no zabbix-proxy package in 3.0
if versioncmp('3.0',$zabbix_version) > 0 {
package { 'zabbix-proxy':
ensure => $zabbix_package_state,
require => Package["zabbix-proxy-${db}"],
tag => 'zabbix',
}
}

# Installing the packages
package { "zabbix-proxy-${db}":
ensure => $zabbix_package_state,
tag => 'zabbix',
}
} # END 'redhat','centos','oraclelinux'
default : {
# Installing the packages
package { "zabbix-proxy-${db}":
ensure => $zabbix_package_state,
tag => 'zabbix',
}
} # END default
} # END case $facts['os']['name']
# Installing the packages
package { "zabbix-proxy-${db}":
ensure => $zabbix_package_state,
tag => 'zabbix',
}

# Controlling the 'zabbix-proxy' service
if $manage_service {
Expand Down
25 changes: 19 additions & 6 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
priority => '1',
}

# Zabbix 5.0 frontend on CentOS 7 has different location.
if ($facts['os']['name'] == 'CentOS' and $majorrelease == '7' and $zabbix_version == '5.0') {
# Zabbix 5.0 frontend on EL7 has different location.
if ($majorrelease == '7' and $zabbix_version == '5.0') {
$_frontend_repo_location = $frontend_repo_location ? {
undef => "https://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/\$basearch/frontend",
default => $frontend_repo_location,
Expand All @@ -87,10 +87,23 @@
}
}

if ($facts['os']['name'] == 'CentOS' and $facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) {
package { 'zabbix-required-scl-repo':
ensure => 'latest',
name => 'centos-release-scl',
if ($facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) {
case $facts['os']['name'] {
'CentOS': {
$scl_package_name = 'centos-release-scl'
}
'OracleLinux': {
$scl_package_name = 'oracle-softwarecollection-release-el7'
}
default: {
$scl_package_name = undef
}
}
if $scl_package_name {
package { 'zabbix-required-scl-repo':
ensure => 'latest',
name => $scl_package_name,
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions manifests/web.pp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@
}
}

case $facts['os']['name'] {
'ubuntu', 'debian': {
case $facts['os']['family'] {
'Debian': {
$zabbix_web_package = 'zabbix-frontend-php'
$php_db_package = "php-${db}"

Expand All @@ -230,7 +230,7 @@
],
}
}
'CentOS', 'RedHat': {
'RedHat': {
$zabbix_web_package = 'zabbix-web'
if ($facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) {
package { "zabbix-web-${db}-scl":
Expand Down Expand Up @@ -258,7 +258,7 @@
tag => 'zabbix',
}
}
} # END case $facts['os']['name']
} # END case $facts['os']['family']

file { '/etc/zabbix/web':
ensure => directory,
Expand Down
3 changes: 2 additions & 1 deletion spec/acceptance/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
class { 'postgresql::globals':
encoding => 'UTF-8',
locale => 'en_US.UTF-8',
manage_package_repo => true,
manage_package_repo => $facts['os']['release']['major'] != '8',
manage_dnf_module => $facts['os']['release']['major'] == '8',
version => '12',
}
-> class { 'postgresql::server': }
Expand Down
3 changes: 2 additions & 1 deletion spec/acceptance/zabbix_application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class { 'apache':
include apache::mod::php
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => true,
manage_package_repo => $facts['os']['release']['major'] != '8',
manage_dnf_module => $facts['os']['release']['major'] == '8',
version => '12',
}
-> class { 'postgresql::server': }
Expand Down
3 changes: 2 additions & 1 deletion spec/acceptance/zabbix_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class { 'apache':
include apache::mod::php
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => true,
manage_package_repo => $facts['os']['release']['major'] != '8',
manage_dnf_module => $facts['os']['release']['major'] == '8',
version => '12',
}
-> class { 'postgresql::server': }
Expand Down
3 changes: 2 additions & 1 deletion spec/acceptance/zabbix_hostgroup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class { 'apache':
include apache::mod::php
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => true,
manage_package_repo => $facts['os']['release']['major'] != '8',
manage_dnf_module => $facts['os']['release']['major'] == '8',
version => '12',
}
-> class { 'postgresql::server': }
Expand Down
3 changes: 2 additions & 1 deletion spec/acceptance/zabbix_proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class { 'apache':
include apache::mod::php
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => true,
manage_package_repo => $facts['os']['release']['major'] != '8',
manage_dnf_module => $facts['os']['release']['major'] == '8',
version => '12',
}
-> class { 'postgresql::server': }
Expand Down
3 changes: 2 additions & 1 deletion spec/acceptance/zabbix_template_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class { 'apache':
include apache::mod::php
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => true,
manage_package_repo => $facts['os']['release']['major'] != '8',
manage_dnf_module => $facts['os']['release']['major'] == '8',
version => '12',
}
-> class { 'postgresql::server': }
Expand Down
3 changes: 2 additions & 1 deletion spec/acceptance/zabbix_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class { 'apache':
include apache::mod::php
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => true,
manage_package_repo => $facts['os']['release']['major'] != '8',
manage_dnf_module => $facts['os']['release']['major'] == '8',
version => '12',
}
-> class { 'postgresql::server': }
Expand Down
15 changes: 6 additions & 9 deletions spec/classes/database_postgresql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,18 @@
end

supported_versions.each do |zabbix_version|
path = case facts[:os]['name']
when 'CentOS', 'RedHat', 'OracleLinux', 'VirtuozzoLinux'
# Path on RedHat
path = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
# Path on EL7
if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
'/usr/share/zabbix-sql-scripts/postgresql/'
else
"/usr/share/doc/zabbix-*-pgsql-#{zabbix_version}*/"
end
# Path on Debian and EL8
elsif Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
'/usr/share/zabbix-sql-scripts/postgresql/'
else
# Path on Debian
if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
'/usr/share/zabbix-sql-scripts/postgresql/'
else
'/usr/share/doc/zabbix-*-pgsql'
end
'/usr/share/doc/zabbix-*-pgsql'
end

sql_server = case zabbix_version
Expand Down
1 change: 1 addition & 0 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4') }

it { is_expected.to contain_package('zabbix-required-scl-repo').with_ensure('latest').with_name('centos-release-scl') } if facts[:os]['name'] == 'CentOS'
it { is_expected.to contain_package('zabbix-required-scl-repo').with_ensure('latest').with_name('oracle-softwarecollection-release-el7') } if facts[:os]['name'] == 'OracleLinux'
end
when '9'

Expand Down

0 comments on commit f22bc00

Please sign in to comment.