Puppet Function: auditd::validate_init_params

Defined in:
functions/validate_init_params.pp
Function type:
Puppet Language

Summary

Validates selected params from the main auditd class.

Overview

auditd::validate_init_params()None

Moved into a function to reduce class clutter.

Fails on discovered errors.

Returns:

  • (None)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'functions/validate_init_params.pp', line 9

function auditd::validate_init_params {
  if (( '%' in $auditd::space_left ) or ( '%' in $auditd::admin_space_left )) {
    if $facts['auditd_version'] and ( versioncmp($facts['auditd_version'], '2.8.5') < 0 ) {
      fail('$space_left and $admin_space_left cannot contain "%" in auditd < 2.8.5')
    }
  }

  if $auditd::space_left.type('generalized') == $auditd::admin_space_left.type('generalized') {
    if $auditd::admin_space_left =~ String {
      if Integer($auditd::admin_space_left.regsubst(/%$/, '')) > Integer($auditd::space_left.regsubst(/%$/, '')) {
        fail('Auditd requires $space_left to be greater than $admin_space_left, otherwise it will not start')
      }
    } else {
      if $auditd::admin_space_left > $auditd::space_left {
        fail('Auditd requires $space_left to be greater than $admin_space_left, otherwise it will not start')
      }
    }
  } else {
    debug('$auditd::space_left and $auditd::admin_space_left are not of the same data type, cannot compare for sanity')
  }
}