Skip to content

Commit

Permalink
Don't install alert.rules file if there's no content for it
Browse files Browse the repository at this point in the history
  • Loading branch information
jhooyberghs committed Dec 5, 2017
1 parent 87124c1 commit 695cc33
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions manifests/alerts.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
String $alertfile_name = 'alert.rules'
) inherits prometheus::params {

if ( versioncmp($::prometheus::version, '2.0.0') < 0 ){

if $alerts != [] {
if $alerts != [] and $alerts != {} {
if ( versioncmp($::prometheus::version, '2.0.0') < 0 ){

file { "${location}/${alertfile_name}":
ensure => 'file',
Expand All @@ -27,17 +26,16 @@
}

}
else {

}
else {
file { "${location}/${alertfile_name}":
ensure => 'file',
owner => $prometheus::user,
group => $prometheus::group,
notify => Class['::prometheus::service_reload'],
content => $alerts.to_yaml,
}

file { "${location}/${alertfile_name}":
ensure => 'file',
owner => $prometheus::user,
group => $prometheus::group,
notify => Class['::prometheus::service_reload'],
content => $alerts.to_yaml,
}

}
}

0 comments on commit 695cc33

Please sign in to comment.