Skip to content

Commit

Permalink
Simplify conntrack package name selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ananace committed Sep 27, 2024
1 parent 4a380fc commit 682d184
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 3 additions & 5 deletions manifests/node.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@
}
if $k8s::manage_packages {
# Ensure conntrack is installed to properly handle networking cleanup
if fact('os.family') == 'Debian' {
$_conntrack = 'conntrack'
} else {
$_conntrack = 'conntrack-tools'
$_conntrack = fact('os.family') ? {
'Debian' => 'conntrack',
default => 'conntrack-tools',
}

ensure_packages([$_conntrack,])
}

Expand Down
6 changes: 6 additions & 0 deletions spec/classes/node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
let(:facts) { os_facts }

it { is_expected.to compile }

if os_facts.dig('os', 'family') == 'Debian'
it { is_expected.to contain_package 'conntrack' }
else
it { is_expected.to contain_package 'conntrack-tools' }
end
end
end
end

0 comments on commit 682d184

Please sign in to comment.