From 24344a6a1739bb1cbd4849d914b2c0b1c7416152 Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Thu, 13 Sep 2018 16:35:56 +0200 Subject: [PATCH] fix #475 Remove default apply_target from service object --- README.md | 2 +- manifests/object.pp | 2 +- manifests/object/service.pp | 1 - templates/object.conf.erb | 8 ++++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 526e3db41..1677d5417 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/manifests/object.pp b/manifests/object.pp index 52206f60d..ee1854ae9 100644 --- a/manifests/object.pp +++ b/manifests/object.pp @@ -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. diff --git a/manifests/object/service.pp b/manifests/object/service.pp index 6b62be0e3..e44cd6bde 100644 --- a/manifests/object/service.pp +++ b/manifests/object/service.pp @@ -234,7 +234,6 @@ import => $import, apply => $apply, prefix => $prefix, - apply_target => 'Host', assign => $assign, ignore => $ignore, template => $template, diff --git a/templates/object.conf.erb b/templates/object.conf.erb index 3a0c77269..64778be8e 100644 --- a/templates/object.conf.erb +++ b/templates/object.conf.erb @@ -4,9 +4,9 @@ <% 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 -%> @@ -14,8 +14,8 @@ <% 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 %>"