Revision ac5b79c7
Added by Joshua Hoblitt almost 10 years ago
spec/classes/init_spec.rb | ||
---|---|---|
} end
|
||
|
||
let(:facts) do {
|
||
:domain => 'example.org',
|
||
:osfamily => osfamily,
|
||
} end
|
||
|
||
it { should compile.with_all_deps }
|
||
|
||
it {
|
||
content = subject.resource('concat_fragment', 'dhcp.conf+01_main.dhcp').send(:parameters)[:content]
|
||
content.split("\n").reject { |c| c =~ /(^\s*#|^$)/ }.should == [
|
||
'omapi-port 7911;',
|
||
'default-lease-time 600;',
|
||
'max-lease-time 7200;',
|
||
'ddns-update-style none;',
|
||
'option domain-name "example.org";',
|
||
'option domain-name-servers 8.8.8.8, 8.8.4.4;',
|
||
'allow booting;',
|
||
'allow bootp;',
|
||
'option fqdn.no-client-update on; # set the "O" and "S" flag bits',
|
||
'option fqdn.rcode2 255;',
|
||
'option pxegrub code 150 = text ;',
|
||
'log-facility local7;',
|
||
'include "/etc/dhcp/dhcpd.hosts";',
|
||
]
|
||
}
|
||
end
|
||
|
||
describe "dhcp class parameters on #{osfamily}" do
|
||
let(:params) do {
|
||
:interfaces => ['eth0'],
|
||
:dnsupdatekey => 'mydnsupdatekey',
|
||
:pxeserver => '10.0.0.5',
|
||
:pxefilename => 'mypxefilename',
|
||
} end
|
||
|
||
let(:facts) do {
|
||
:domain => 'example.org',
|
||
:osfamily => osfamily,
|
||
} end
|
||
|
||
it { should compile.with_all_deps }
|
||
|
||
it {
|
||
content = subject.resource('concat_fragment', 'dhcp.conf+01_main.dhcp').send(:parameters)[:content]
|
||
content.split("\n").reject { |c| c =~ /(^\s*#|^$)/ }.should == [
|
||
'omapi-port 7911;',
|
||
'default-lease-time 600;',
|
||
'max-lease-time 7200;',
|
||
'ddns-updates on;',
|
||
'ddns-update-style interim;',
|
||
'update-static-leases on;',
|
||
'use-host-decl-names on;',
|
||
'include "mydnsupdatekey";',
|
||
'zone example.org. {',
|
||
' primary 8.8.8.8;',
|
||
' key rndc-key;',
|
||
'}',
|
||
'option domain-name "example.org";',
|
||
'option domain-name-servers 8.8.8.8, 8.8.4.4;',
|
||
'allow booting;',
|
||
'allow bootp;',
|
||
'option fqdn.no-client-update on; # set the "O" and "S" flag bits',
|
||
'option fqdn.rcode2 255;',
|
||
'option pxegrub code 150 = text ;',
|
||
'next-server 10.0.0.5;',
|
||
'filename "mypxefilename";',
|
||
'log-facility local7;',
|
||
'include "/etc/dhcp/dhcpd.hosts";',
|
||
]
|
||
}
|
||
end
|
||
end
|
||
end
|
templates/dhcpd.conf.erb | ||
---|---|---|
option fqdn.rcode2 255;
|
||
option pxegrub code 150 = text ;
|
||
|
||
<% if has_variable?( 'pxeserver' ) and has_variable?( 'pxefilename' ) then -%>
|
||
<% if has_variable?( 'pxeserver' ) &&
|
||
has_variable?( 'pxefilename' ) &&
|
||
@pxeserver &&
|
||
@pxefilename -%>
|
||
# PXE Handoff.
|
||
next-server <%= @pxeserver %>;
|
||
filename "<%= @pxefilename %>";
|
Also available in: Unified diff
allow pxe section in dhcpd.conf.erb to be disabled