Browse Source

Added a types parameter to the user object and rendering of it to the ERB template.

Nick Chappell 9 years ago
parent
commit
6ad25eee99
2 changed files with 4 additions and 2 deletions
  1. 1 1
      manifests/object/user.pp
  2. 3 1
      templates/object_user.conf.erb

+ 1 - 1
manifests/object/user.pp

@@ -18,8 +18,8 @@ define icinga2::object::user (
   $groups = [],
   $enable_notifications = undef,
   $period = undef,
+  $types = [],
   #Parameters to add:
-  # types
   # states
   $target_dir = '/etc/icinga2/conf.d',
   $target_file_name = "${fqdn}.conf",

+ 3 - 1
templates/object_user.conf.erb

@@ -11,7 +11,6 @@
  */
 
 //Parameters to add:
-// types
 // states
 
 object User "<%= @object_username %>" {
@@ -43,4 +42,7 @@ object User "<%= @object_username %>" {
   <%- if @period -%>
   period "<%= @period -%>"
   <%- end -%>
+  <%- if @types.length != 0 -%>
+  types = [ <%- @types.each do |type| -%> <%= type %>, <%- end -%>]
+  <%- end -%>
 }