Puppet Class: rsyslog::config::global

Defined in:
manifests/config/global.pp

Overview



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
# File 'manifests/config/global.pp', line 1

class rsyslog::config::global {
  #create a hash just with legacy type values
  $legacytype = $rsyslog::config::global_config.filter |$key, $value| { has_key( $value, 'type') }

  $legacytype.each |$param, $config| {
    rsyslog::component::global_config { $param:
      * => {
        'priority' => $rsyslog::global_config_priority,
        'target'   => $rsyslog::target_file,
        'confdir'  => $rsyslog::confdir,
      } + $config,
    }
  }

  #create a hash just with the non legacy type value
  $newtype = $rsyslog::config::global_config.filter |$key, $value| { ! has_key( $value, 'type') }

  #flatten the nested hash of hashes to one single hash
  $flattendata = $newtype.keys.reduce( {}) |$memo, $key| { $memo + { $key => $newtype[$key]["value"] } }

  unless empty($flattendata) {
    rsyslog::component::global_config {
      default:
        priority => $rsyslog::global_config_priority,
        target   => $rsyslog::target_file,
        confdir  => $rsyslog::confdir,
        ;
      'rainerscript':
        config => $flattendata,
        ;
    }
  }
}