Skip to content

Commit

Permalink
Merge pull request #10 from alexjfisher/remove_legacy_facts
Browse files Browse the repository at this point in the history
Use modern facts and stdlib `fact()` function
  • Loading branch information
alexjfisher authored Nov 6, 2018
2 parents 59cbae6 + 87a277b commit 1086212
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
# @api private
class nrpe::params {

$nrpe_provider = $::osfamily ? {
$nrpe_provider = fact('os.family') ? {
'Solaris' => pkgutil,
default => undef,
}

$nrpe_files_group = $::osfamily ? {
$nrpe_files_group = fact('os.family') ? {
/(Free|Open)BSD/ => 'wheel',
default => 'root',
default => 'root',
}

$nrpe_plugin_file_mode = '0755'

case $::osfamily {
case fact('os.family') {
'Debian': {
$libdir = '/usr/lib/nagios/plugins'
$nrpe_user = 'nagios'
Expand Down Expand Up @@ -45,7 +45,7 @@
]
}
'RedHat': {
$libdir = $::architecture ? {
$libdir = fact('os.architecture') ? {
/x86_64/ => '/usr/lib64/nagios/plugins',
default => '/usr/lib/nagios/plugins',
}
Expand Down Expand Up @@ -95,7 +95,7 @@
$nrpe_group = 'nagios'
$nrpe_pid_file = '/var/run/nrpe/nrpe.pid'
$nrpe_service = 'nrpe'
case $::operatingsystem {
case fact('os.name') {
'SLES': {
$nrpe_config = '/etc/nagios/nrpe.cfg'
$nrpe_ssl_dir = '/etc/nagios/nrpe-ssl'
Expand All @@ -118,7 +118,7 @@
}
}
'Gentoo': {
$libdir = $::architecture ? {
$libdir = fact('os.architecture') ? {
/x86_64/ => '/usr/lib64/nagios/plugins',
default => '/usr/lib/nagios/plugins',
}
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/nrpe_config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'nrpe::config' do
on_supported_os.each do |os, facts|
on_supported_os(facterversion: '3.6').each do |os, facts|
context "on #{os}" do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/nrpe_config_ssl_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'nrpe::config::ssl' do
on_supported_os.each do |os, facts|
on_supported_os(facterversion: '3.6').each do |os, facts|
context "on #{os}" do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/nrpe_install_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'nrpe::install' do
on_supported_os.each do |os, facts|
on_supported_os(facterversion: '3.6').each do |os, facts|
context "on #{os}" do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/nrpe_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'nrpe::service' do
on_supported_os.each do |os, facts|
on_supported_os(facterversion: '3.6').each do |os, facts|
context "on #{os}" do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/nrpe_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'nrpe' do
on_supported_os.each do |os, facts|
on_supported_os(facterversion: '3.6').each do |os, facts|
context "on #{os}" do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/command_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'nrpe::command' do
on_supported_os.each do |os, facts|
on_supported_os(facterversion: '3.6').each do |os, facts|
context "on #{os}" do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/plugin_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'nrpe::plugin' do
on_supported_os.each do |os, facts|
on_supported_os(facterversion: '3.6').each do |os, facts|
context "on #{os}" do
let :facts do
facts
Expand Down

0 comments on commit 1086212

Please sign in to comment.