Skip to content

Commit

Permalink
Debian default ipv4 interfaces config has changed
Browse files Browse the repository at this point in the history
Since stretch, the /etc/default/isc-dhcp-server entry for the
interfaces to listen on has changed to INTERFACESv4. This change
reflects that.

Fixes voxpupuli#177 and closes voxpupuli#185
  • Loading branch information
vStone committed Jul 26, 2018
1 parent eb49b54 commit 6611940
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
37 changes: 34 additions & 3 deletions spec/classes/dhcp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,21 @@
let :default_facts do
{
osfamily: 'Debian',
concat_basedir: '/dne'
concat_basedir: '/dne',
}
end

context 'Debian' do
context 'Debian < 9' do
let :facts do
default_facts.merge(operatingsystem: 'Debian', os: { family: 'Debian' })
default_facts.merge(
os: {
name: 'Debian',
family: 'Debian',
release: {
major: 8,
},
}
)
end
let :params do
default_params.merge(interface: 'eth0')
Expand All @@ -484,6 +492,29 @@
with_content(%r{INTERFACES=\"eth0\"})
end
end
context 'Debian > 9' do
let :facts do
default_facts.merge(
os: {
name: 'Debian',
family: 'Debian',
release: {
major: 9,
},
}
)
end
let :params do
default_params.merge(interface: 'eth0')
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('isc-dhcp-server') }
it do
is_expected.to contain_file('/etc/default/isc-dhcp-server'). \
with_content(%r{INTERFACESv4=\"eth0\"})
end
end
context 'Ubuntu' do
let :params do
default_params.merge(interface: 'eth0')
Expand Down
9 changes: 8 additions & 1 deletion templates/debian/default_isc-dhcp-server
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="<%= Array(@dhcp_interfaces).join(' ') %>"
<%
if @facts['os']['name'] == 'Debian' && @facts['os']['release']['major'] >= 9
interfaces_key = 'INTERFACESv4'
else
interfaces_key = 'INTERFACES'
end
%>
<%= interfaces_key %>="<%= Array(@dhcp_interfaces).join(' ') %>"

0 comments on commit 6611940

Please sign in to comment.