diff --git a/manifests/filter.pp b/manifests/filter.pp index 8c7bec8..376c220 100644 --- a/manifests/filter.pp +++ b/manifests/filter.pp @@ -92,7 +92,10 @@ define fail2ban::filter ( $manage_file_content = $filtertemplate ? { '' => undef, - default => template($filtertemplate), + default => $filtersource ? { + '' => template($filtertemplate), + default => undef, + } } file { "${real_filtername}.local": diff --git a/spec/defines/fail2ban_filter_spec.rb b/spec/defines/fail2ban_filter_spec.rb index 6eac9af..2b7b712 100644 --- a/spec/defines/fail2ban_filter_spec.rb +++ b/spec/defines/fail2ban_filter_spec.rb @@ -61,7 +61,7 @@ b = 2 not c " end - + it { should contain_file('sample2.local').with_path('/etc/fail2ban/filter.d/sample2.local').with_content(expected) } it { should contain_file('sample2.local').without_source } end @@ -75,6 +75,7 @@ not c end it { should contain_file('sample3.local').with_path('/etc/fail2ban/filter.d/sample3.local').with_source('puppet:///some/path/to/source') } + it { should contain_file('sample3.local').with_content(nil) } it { should contain_file('sample3.local').without_template } end end