Skip to content

Commit

Permalink
fix merge conflicts #602
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Apr 24, 2020
2 parents 6cd1b1f + c71d295 commit 42fd71c
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 7 deletions.
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ If set to false packages aren't managed.

Default value: `true`

##### `manage_selinux`

Data type: `Boolean`

If set to true the icinga selinux package is installed. Requires a `selinux_package_name` (icinga2::globals)
and `manage_package` has to be set to true.

Default value: `false`

##### `manage_service`

Data type: `Boolean`
Expand Down
1 change: 1 addition & 0 deletions data/RedHat-family-5.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
icinga2::globals::icinga2_bin: /usr/sbin/icinga2
icinga2::manage_selinux: false
1 change: 1 addition & 0 deletions data/RedHat-family-6.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
icinga2::globals::icinga2_bin: /usr/sbin/icinga2
icinga2::manage_selinux: false
1 change: 1 addition & 0 deletions data/RedHat-family.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
icinga2::globals::user: icinga
icinga2::globals::group: icinga
icinga2::globals::icinga2_bin: /sbin/icinga2
icinga2::globals::selinux_package_name: icinga2-selinux
icinga2::repo:
baseurl: 'http://packages.icinga.com/epel/%{facts.os.release.major}/release/'
descr: ICINGA (stable release for epel)
Expand Down
4 changes: 4 additions & 0 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
# CAUTION: This does not manage the group context for the runnig icinga 2 process!
# The parameter is only used for group membership of files or directories.
#
# @param [Optional[String]] selinux_package_name
# The name of the icinga selinux package.
#
# @param [Optional[String]] ido_mysql_package_name
# The name of the icinga package that's needed for MySQL.
#
Expand Down Expand Up @@ -80,6 +83,7 @@
Array[String] $reserved,
Optional[String] $user = undef,
Optional[String] $group = undef,
Optional[String] $selinux_package_name = undef,
Optional[String] $ido_mysql_package_name = undef,
Optional[String] $ido_pgsql_package_name = undef,
Optional[String] $service_reload = undef,
Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
# @param [Boolean] manage_package
# If set to false packages aren't managed.
#
# @param [Boolean] manage_selinux
# If set to true the icinga selinux package is installed. Requires a `selinux_package_name` (icinga2::globals)
# and `manage_package` has to be set to true.
#
# @param [Boolean] manage_service
# If set to true the service is managed otherwise the service also
# isn't restarted if a config file changed.
Expand Down Expand Up @@ -114,6 +118,7 @@
Boolean $enable = true,
Boolean $manage_repo = false,
Boolean $manage_package = true,
Boolean $manage_selinux = false,
Boolean $manage_service = true,
Boolean $purge_features = true,
Hash $constants = {},
Expand Down
29 changes: 22 additions & 7 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@

assert_private()

$package_name = $::icinga2::globals::package_name
$manage_package = $::icinga2::manage_package
$cert_dir = $::icinga2::globals::cert_dir
$conf_dir = $::icinga2::globals::conf_dir
$user = $::icinga2::globals::user
$group = $::icinga2::globals::group
$package_name = $::icinga2::globals::package_name
$manage_package = $::icinga2::manage_package
$selinux_package_name = $::icinga2::globals::selinux_package_name
$manage_selinux = $::icinga2::manage_selinux
$cert_dir = $::icinga2::globals::cert_dir
$conf_dir = $::icinga2::globals::conf_dir
$user = $::icinga2::globals::user
$group = $::icinga2::globals::group

if $manage_package {
if $::osfamily == 'windows' { Package { provider => chocolatey, } }
Expand All @@ -22,9 +24,22 @@
ensure => installed,
before => File[$cert_dir, $conf_dir],
}

if str2bool($manage_selinux) and $selinux_package_name {
package { $selinux_package_name:
ensure => installed,
require => Package[$package_name],
}
}
}

file { [$conf_dir]:
ensure => directory,
owner => $user,
group => $group,
}

file { [$cert_dir, $conf_dir]:
file { [$cert_dir]:
ensure => directory,
owner => $user,
group => $group,
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/icinga2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@
it { should_not contain_package('icinga2').with({ 'ensure' => 'installed' }) }
end

context "with manage_selinux => true" do
let(:params) do
{:manage_selinux => true}
end

case facts[:osfamily]
when 'RedHat'
it { should contain_package('icinga2-selinux').with({ 'ensure' => 'installed' }) }
end
end

context "with confd => false" do
let(:params) do
{:confd => false}
Expand Down

0 comments on commit 42fd71c

Please sign in to comment.