Browse Source

* fixed typos, changed default values and changed parameters validation.

Signed-off-by: Nick Chappell <nick@intronic.org>

Merged in from: https://github.com/Icinga/puppet-icinga2/pull/33

refs#7215: https://dev.icinga.org/issues/7215
Ricardo Melo 9 years ago
parent
commit
6af3b7b9ae
2 changed files with 10 additions and 5 deletions
  1. 9 4
      manifests/object/eventcommand.pp
  2. 1 1
      templates/object_eventcommand.conf.erb

+ 9 - 4
manifests/object/eventcommand.pp

@@ -15,11 +15,11 @@ define icinga2::object::eventcommand (
 /*  $methods           = undef, */ /* Need to get more details about this attribute */
   $command           = undef,
   $cmd_path          = 'PluginDir',
-  $arguments         = {},
+  $arguments         = undef,
   $env               = undef,
-  $vars              = {},
+  $vars              = undef,
   $timeout           = undef,
-  $target_dir        = '/etc/icinga2/conf.d',
+  $target_dir        = '/etc/icinga2/objects/eventcommands',
   $target_file_name  = "${name}.conf",
   $target_file_owner = 'root',
   $target_file_group = 'root',
@@ -31,10 +31,15 @@ define icinga2::object::eventcommand (
   validate_string($template_to_import)
   validate_array($command)
   validate_string($cmd_path)
+  if $arguments {
+    validate_hash($arguments)
+  }
   if $env {
     validate_hash($env)
   }
-  validate_hash($vars)
+  if $vars {
+    validate_hash($vars)
+  }
   if $timeout {
     validate_re($timeout, '^\d+$')
   }

+ 1 - 1
templates/object_eventcommand.conf.erb

@@ -54,7 +54,7 @@ object EventCommand "<%= @object_eventcommandname %>" {
 
   <%- if @env -%>
   env = {
-  <%- @vars.each_pair do |key,value| -%>
+  <%- @env.each_pair do |key,value| -%>
     <%= key %> = <%= value %>
   <%- end -%>
   }