Skip to content

Commit

Permalink
(profile::core::firewall) include ipset
Browse files Browse the repository at this point in the history
As `ipset` won't be used unless profile::core::firewall is included, it
makes sense to include `ipset` from the profile instead of forcing roles
to directly include it.
  • Loading branch information
jhoblitt committed Nov 14, 2023
1 parent 71a18ba commit 482046c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
1 change: 0 additions & 1 deletion hieradata/role/perfsonar.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
classes:
- "ipset"
- "ntp"
- "profile::core::common"
- "profile::core::debugutils"
Expand Down
1 change: 1 addition & 0 deletions site/profile/manifests/core/firewall.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Boolean $purge_firewall = false,
) {
include firewall
include ipset

if $purge_firewall {
resources { 'firewall': purge => true }
Expand Down
43 changes: 43 additions & 0 deletions spec/classes/core/firewall_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'profile::core::firewall' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('firewall') }
it { is_expected.to contain_class('ipset') }
it { is_expected.to have_resources_resource_count(0) }
it { is_expected.to have_firewall_resource_count(0) }

context 'with purge_firewall param' do
let(:params) { { purge_firewall: true } }

it { is_expected.to contain_resources('firewall').with_purge(true) }
end

context 'with firewall param' do
let(:params) do
{
firewall: {
'001 accept all icmp' => {
'proto' => 'icmp',
'action' => 'accept',
},
},
}
end

it do
is_expected.to contain_firewall('001 accept all icmp').with(
'proto' => 'icmp',
'action' => 'accept',
)
end
end
end
end
end

0 comments on commit 482046c

Please sign in to comment.