From 2f2345da4ca8ccc7146f57bc28df386e090fb1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20L=2E=20Mateo?= <amateo@um.es> Date: Tue, 13 Mar 2018 09:40:55 +0100 Subject: [PATCH] Fix huntgroups with array of conditions Where there is more than one condition, then multiple huntgroup lines should be created --- manifests/huntgroup.pp | 6 +----- templates/huntgroup.erb | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/manifests/huntgroup.pp b/manifests/huntgroup.pp index 80a6031..2bef0bd 100644 --- a/manifests/huntgroup.pp +++ b/manifests/huntgroup.pp @@ -8,13 +8,9 @@ define freeradius::huntgroup ( $fr_basepath = $::freeradius::params::fr_basepath $fr_service = $::freeradius::params::fr_service - $conditionals = join($conditions, ', ') - - $content = "${huntgroup}\t${conditionals}\n" - concat::fragment { "huntgroup.${title}": target => "${fr_basepath}/mods-config/preprocess/huntgroups", - content => $content, + content => template('freeradius/huntgroup.erb'), order => $order, notify => Service[$fr_service], } diff --git a/templates/huntgroup.erb b/templates/huntgroup.erb index 958fd3a..bfaa0d5 100644 --- a/templates/huntgroup.erb +++ b/templates/huntgroup.erb @@ -1,10 +1,6 @@ -# -########################################################## -# Huntgroup Puppet Name: <%= @name %> -# <%- if @conditions.is_a?(Array) -%> -<%= @conditions.collect { |cond| @name + " " + cond }.join("\n") %> +<%= @conditions.collect { |cond| @huntgroup + " " + cond }.join("\n") %> <%- else -%> -<%= @name %> <%= @conditions %> +<%= @huntgroup %> <%= @conditions %> <%- end -%> -- GitLab