Skip to content

Commit

Permalink
fix #475 Remove default apply_target from service object
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Sep 13, 2018
1 parent 229171c commit 24344a6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,7 @@ Dispose an apply instead an object if set to 'true'. Value is taken as statement
i.e. 'vhost => config in host.vars.vhosts'. Defaults to false.

##### `apply_target`
An object type on which to target the apply rule. Valid values are `Host` and `Service`. Defaults to `Host`.
Optional fo an object type on which to target the apply rule. Valid values are `Host` and `Service`. Defaults to `Host`.

##### `import`
A sorted list of templates to import in this object. Defaults to an empty array.
Expand Down
2 changes: 1 addition & 1 deletion manifests/object.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Set object_name as prefix in front of 'apply for'. Only effects if apply is a string. Defaults to false.
#
# [*apply_target*]
# An object type on which to target the apply rule. Valid values are `Host` and `Service`. Defaults to `Host`.
# Optional for an object type on which to target the apply rule. Valid values are `Host` and `Service`.
#
# [*import*]
# A sorted list of templates to import in this object. Defaults to an empty array.
Expand Down
1 change: 0 additions & 1 deletion manifests/object/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@
import => $import,
apply => $apply,
prefix => $prefix,
apply_target => 'Host',
assign => $assign,
ignore => $ignore,
template => $template,
Expand Down
8 changes: 4 additions & 4 deletions templates/object.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
<% if scope.lookupvar('icinga2::_constants').include?(@object_name) -%>
<%= @object_name -%>
<% else -%>
"<%= @object_name %>" <% end -%>
"<%= @object_name %>"<% end -%>
<% end -%>
for (<%= @apply %>) to <%= @apply_target -%> {
for (<%= @apply %>)<%if @apply_target %>to <%=apply_target %><% end %> {
<% else -%>
<% if @apply %>apply<% else -%>
<% if @template %>template<% else %>object<% end -%>
<% end %> <%= @object_type -%>
<% if scope.lookupvar('icinga2::_constants').include?(@object_name) -%>
<%= @object_name -%>
<% else -%>
"<%= @object_name %>" <% end -%>
<% if @apply && @apply_target %>to <%= @apply_target -%><% end -%> {
"<%= @object_name %>"<% end -%>
<% if @apply && @apply_target %>to <%= @apply_target %><% end -%> {
<% end -%>
<% @import.each do |i| -%>
import "<%= i %>"
Expand Down

0 comments on commit 24344a6

Please sign in to comment.