Skip to content

Commit

Permalink
Merge branch 'bug/replace-selectors-inside-resource-blocks-262'
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Mar 20, 2017
2 parents fadd93d + d7f7eb1 commit 170f14a
Show file tree
Hide file tree
Showing 22 changed files with 222 additions and 187 deletions.
7 changes: 3 additions & 4 deletions manifests/config/fragment.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@
group => 'NETWORK SERVICE',
mode => '0770',
}
$_content = regsubst($content, '\n', "\r\n", 'EMG')
} # windows
default: {
Concat {
owner => $::icinga2::params::user,
group => $::icinga2::params::group,
mode => '0640',
}
$_content = $content
} # default
}

Expand All @@ -56,10 +58,7 @@

concat::fragment { "icinga2::config::${code_name}":
target => $target,
content => $::osfamily ? {
'windows' => regsubst($content, '\n', "\r\n", 'EMG'),
default => $content,
},
content => $_content,
order => $order,
notify => Class['::icinga2::service'],
}
Expand Down
20 changes: 12 additions & 8 deletions manifests/feature.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,27 @@
$conf_dir = $::icinga2::params::conf_dir

if $::osfamily != 'windows' {
$_ensure = $ensure ? {
'present' => link,
default => absent,
}

file { "${conf_dir}/features-enabled/${feature}.conf":
ensure => $ensure ? {
'present' => link,
default => absent,
},
ensure => $_ensure,
owner => $user,
group => $group,
target => "../features-available/${feature}.conf",
require => Concat["${conf_dir}/features-available/${feature}.conf"],
notify => Class['::icinga2::service'],
}
} else {
$_ensure = $ensure ? {
'present' => file,
default => absent,
}

file { "${conf_dir}/features-enabled/${feature}.conf":
ensure => $ensure ? {
'present' => file,
default => absent,
},
ensure => $_ensure,
owner => $user,
group => $group,
content => "include \"../features-available/${feature}.conf\"\r\n",
Expand Down
67 changes: 36 additions & 31 deletions manifests/feature/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,20 @@
$bind_port = undef,
) {

$conf_dir = $::icinga2::params::conf_dir
$pki_dir = $::icinga2::params::pki_dir
$ca_dir = $::icinga2::params::ca_dir
$user = $::icinga2::params::user
$group = $::icinga2::params::group
$node_name = $::icinga2::_constants['NodeName']
$conf_dir = $::icinga2::params::conf_dir
$pki_dir = $::icinga2::params::pki_dir
$ca_dir = $::icinga2::params::ca_dir
$user = $::icinga2::params::user
$group = $::icinga2::params::group
$node_name = $::icinga2::_constants['NodeName']
$_ssl_key_mode = $::osfamily ? {
'windows' => undef,
default => '0600',
}
$_notify = $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
}

File {
owner => $user,
Expand Down Expand Up @@ -232,10 +240,7 @@
'puppet': {
file { $_ssl_key_path:
ensure => file,
mode => $::kernel ? {
'windows' => undef,
default => '0600',
},
mode => $_ssl_key_mode,
source => $::icinga2_puppet_hostprivkey,
tag => 'icinga2::config::file',
}
Expand All @@ -255,38 +260,41 @@

'none': {
if $ssl_key {
$_ssl_key = $::osfamily ? {
'windows' => regsubst($ssl_key, '\n', "\r\n", 'EMG'),
default => $ssl_key,
}

file { $_ssl_key_path:
ensure => file,
mode => $::kernel ? {
'windows' => undef,
default => '0600',
},
content => $::osfamily ? {
'windows' => regsubst($ssl_key, '\n', "\r\n", 'EMG'),
default => $ssl_key,
},
mode => $_ssl_key_mode,
content => $_ssl_key,
tag => 'icinga2::config::file',
}
}

if $ssl_cert {
$_ssl_cert = $::osfamily ? {
'windows' => regsubst($ssl_cert, '\n', "\r\n", 'EMG'),
default => $ssl_cert,
}

file { $_ssl_cert_path:
ensure => file,
content => $::osfamily ? {
'windows' => regsubst($ssl_cert, '\n', "\r\n", 'EMG'),
default => $ssl_cert,
},
content => $_ssl_cert,
tag => 'icinga2::config::file',
}
}

if $ssl_cacert {
$_ssl_cacert = $::osfamily ? {
'windows' => regsubst($ssl_cacert, '\n', "\r\n", 'EMG'),
default => $ssl_cacert,
}

file { $_ssl_cacert_path:
ensure => file,
content => $::osfamily ? {
'windows' => regsubst($ssl_cacert, '\n', "\r\n", 'EMG'),
default => $ssl_cacert,
},
content => $_ssl_cacert,
tag => 'icinga2::config::file',
}
}
Expand Down Expand Up @@ -330,7 +338,7 @@

notice('This parameter is deprecated and will be removed in future versions! Please use ::icinga2::pki::ca instead')
} # ca
} # pki
} # case pki

# compose attributes
$attrs = {
Expand Down Expand Up @@ -358,10 +366,7 @@
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/api.conf",
order => '10',
notify => $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
},
notify => $_notify,
}

# manage feature
Expand Down
9 changes: 5 additions & 4 deletions manifests/feature/checker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
) {

$conf_dir = $::icinga2::params::conf_dir
$_notify = $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
}

# validation
validate_re($ensure, [ '^present$', '^absent$' ],
Expand All @@ -37,10 +41,7 @@
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/checker.conf",
order => '10',
notify => $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
},
notify => $_notify,
}

# import library 'checker'
Expand Down
11 changes: 6 additions & 5 deletions manifests/feature/command.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
$command_path = "${::icinga2::params::run_dir}/cmd/icinga2.cmd",
) {

$conf_dir = $::icinga2::params::conf_dir
$conf_dir = $::icinga2::params::conf_dir
$_notify = $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
}

validate_re($ensure, [ '^present$', '^absent$' ],
"${ensure} isn't supported. Valid values are 'present' and 'absent'.")
Expand All @@ -36,10 +40,7 @@
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/command.conf",
order => '10',
notify => $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
},
notify => $_notify,
}

# import library 'compat'
Expand Down
11 changes: 6 additions & 5 deletions manifests/feature/compatlog.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
$rotation_method = 'DAILY',
) {

$conf_dir = $::icinga2::params::conf_dir
$conf_dir = $::icinga2::params::conf_dir
$_notify = $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
}

# validation
validate_re($ensure, [ '^present$', '^absent$' ],
Expand All @@ -44,10 +48,7 @@
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/compatlog.conf",
order => '10',
notify => $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
},
notify => $_notify,
}

# import library 'compat'
Expand Down
11 changes: 6 additions & 5 deletions manifests/feature/debuglog.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
$path = "${::icinga2::params::log_dir}/debug.log",
) {

$conf_dir = $::icinga2::params::conf_dir
$conf_dir = $::icinga2::params::conf_dir
$_notify = $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
}

# validation
validate_re($ensure, [ '^present$', '^absent$' ],
Expand All @@ -39,10 +43,7 @@
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/debuglog.conf",
order => '10',
notify => $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
},
notify => $_notify,
}

# manage feature
Expand Down
9 changes: 5 additions & 4 deletions manifests/feature/gelf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
) {

$conf_dir = $::icinga2::params::conf_dir
$_notify = $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
}

# validation
validate_re($ensure, [ '^present$', '^absent$' ],
Expand All @@ -54,10 +58,7 @@
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/gelf.conf",
order => '10',
notify => $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
},
notify => $_notify,
}

# import library 'perfdata'
Expand Down
9 changes: 5 additions & 4 deletions manifests/feature/graphite.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
) {

$conf_dir = $::icinga2::params::conf_dir
$_notify = $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
}

# validation
validate_re($ensure, [ '^present$', '^absent$' ],
Expand Down Expand Up @@ -66,10 +70,7 @@
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/graphite.conf",
order => '10',
notify => $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
},
notify => $_notify,
}

# import library 'perfdata'
Expand Down
Loading

0 comments on commit 170f14a

Please sign in to comment.