Skip to content

Commit

Permalink
add support for setting search domains
Browse files Browse the repository at this point in the history
closes GH-52
  • Loading branch information
John Mehringer authored and mmoll committed Aug 4, 2015
1 parent d66778c commit 1ad54b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions manifests/pool.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$pxeserver = undef,
$domain_name = undef,
$static_routes = undef,
$search_domains = undef,
) {

concat::fragment { "dhcp.conf+70_${name}.dhcp":
Expand Down
2 changes: 2 additions & 0 deletions spec/defines/pool_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
:pxeserver => '10.0.0.2',
:domain_name => 'example.org',
:static_routes => [ { 'mask' => '24', 'network' => '10.0.1.0', 'gateway' => '10.0.0.2' } ],
:search_domains => ['example.org', 'other.example.org'],
} end

it {
Expand All @@ -70,6 +71,7 @@
" option ntp-servers 10.0.0.2;",
" max-lease-time 300;",
" option domain-name-servers 10.0.0.2, 10.0.0.4;",
" option domain-search \"example.org, other.example.org\";",
" next-server 10.0.0.2;",
"}",
])
Expand Down
5 changes: 5 additions & 0 deletions templates/dhcpd.pool.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ subnet <%= @network %> netmask <%= @mask %> {
<% elsif @nameservers -%>
option domain-name-servers <%= @nameservers %>;
<% end -%>
<% if @search_domains and @search_domains.is_a? Array -%>
option domain-search "<%= @search_domains.sort.join(', ') %>";
<% elsif @search_domains -%>
option domain-search "<%= @search_domains %>";
<% end -%>
<% if @pxeserver -%>
next-server <%= @pxeserver %>;
<% end -%>
Expand Down

0 comments on commit 1ad54b3

Please sign in to comment.