Skip to content

Commit

Permalink
Add 'authoritative' parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
domcleal committed Jun 20, 2016
1 parent 9acafb2 commit 3c2114f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/init.pp
Expand Up @@ -24,6 +24,7 @@
$service_ensure = running,
$globaloptions = '',
$omapi_port = undef,
$authoritative = true,
$extra_config = '',
$dhcp_dir = $dhcp::params::dhcp_dir,
$packagename = $dhcp::params::packagename,
Expand Down Expand Up @@ -52,6 +53,7 @@

validate_array($nameservers)
validate_array($ntpservers)
validate_bool($authoritative)

if $pxeserver or $pxefilename {
if ! $pxeserver or ! $pxefilename {
Expand Down
17 changes: 17 additions & 0 deletions spec/classes/dhcp_spec.rb
Expand Up @@ -67,6 +67,10 @@
is_expected.to contain_concat__fragment('dhcp-conf-header')
end

it 'contains authoritative statement' do
is_expected.to contain_concat__fragment('dhcp-conf-header').with_content(/^authoritative/)
end

context 'omapi_port => 7911' do
let :params do
default_params.merge(
Expand All @@ -79,6 +83,19 @@
is_expected.to contain_concat__fragment('dhcp-conf-header')
end
end

context 'authoritative => false' do
let :params do
default_params.merge(
interfaces: ['eth0'],
authoritative: false
)
end

it 'contains not authoritative statement' do
is_expected.to contain_concat__fragment('dhcp-conf-header').with_content(/^not authoritative/)
end
end
end

context 'ntp' do
Expand Down
4 changes: 4 additions & 0 deletions templates/dhcpd.conf-header.erb
Expand Up @@ -2,7 +2,11 @@
# ----------
# dhcpd.conf
# ----------
<% if @authoritative -%>
authoritative;
<% else -%>
not authoritative;
<% end -%>
<% if @omapi_port -%>
omapi-port <%= @omapi_port %>;
<% end -%>
Expand Down

0 comments on commit 3c2114f

Please sign in to comment.