Skip to content

Commit

Permalink
Fix smokeping::target type
Browse files Browse the repository at this point in the history
fixes voxpupuli#74

voxpupuli#70 introduced a
regression.  Several parameters were made mandatory (previously they
defaulted to an empty string.)

They are now `Optional` and default to `undef`.
  • Loading branch information
alexjfisher committed Sep 14, 2018
1 parent f190083 commit 5327bc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
14 changes: 7 additions & 7 deletions manifests/target.pp
Expand Up @@ -30,12 +30,12 @@
# Remark displayed on Website
#
define smokeping::target (
String $pagetitle,
String $menu,
String $hierarchy_parent,
String $probe,
String $host,
String $remark,
Optional[String[1]] $pagetitle = undef,
Optional[String[1]] $menu = undef,
Optional[String[1]] $hierarchy_parent = undef,
Optional[String[1]] $probe = undef,
Optional[String[1]] $host = undef,
Optional[String[1]] $remark = undef,
Integer $hierarchy_level = 1,
Array $alerts = [],
Array $slaves = [],
Expand Down Expand Up @@ -68,7 +68,7 @@
}
} else {
#all other levels
if $hierarchy_parent == '' {
unless $hierarchy_parent {
fail('hierarchy_parent has to be specified for levels > 1')
}
$parent_level = $hierarchy_level - 1
Expand Down
14 changes: 6 additions & 8 deletions templates/target.erb
@@ -1,33 +1,31 @@
<%= '+' * @hierarchy_level.to_i %> <%= @name %>
<% if @probe != '' then -%>
<% if @probe then -%>
probe = <%= @probe %>
<% end -%>

menu = <%= @menu %>
<% if @pagetitle != '' then -%>
<% if @pagetitle then -%>
title = <%= @pagetitle %>
<% else -%>
title = <%= @menu %>
<% end -%>
<% if @host != '' then -%>
<% if @host then -%>
host = <%= @host %>
<% end -%>
<% if ! @alerts.empty? then -%>
<% unless @alerts.empty? then -%>
alerts = <%= @alerts.join(',') %>
<% end -%>
<% if @nomasterpoll then -%>
nomasterpoll = yes
<% end -%>
<% if @slaves != [] then -%>
<% unless @slaves.empty? then -%>
slaves = <%= @slaves.join(' ') %>
<% end -%>
<% if @remark != '' then -%>
<% if @remark then -%>
remark = <%= @remark %>
<% end -%>
<% if @options then -%>
<%- @options.sort.each do |key,value| -%>
<%= key %> = <%= value %>
<%- end -%>
<% end -%>


0 comments on commit 5327bc4

Please sign in to comment.