Skip to content

Commit

Permalink
Merge pull request theforeman#62 from treydock/omapi_port-parameter
Browse files Browse the repository at this point in the history
Add omapi_port parameter
  • Loading branch information
tphoney committed Jul 22, 2015
2 parents dec909c + be6954e commit eceacaa
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Define the server and the zones it will be responsible for.
require => Bind::Key['rndc-key'],
pxeserver => '10.0.1.50',
pxefilename => 'pxelinux.0',
omapi_port => 7911,
}

### dhcp::pool
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$max_lease_time = 86400,
$service_ensure = running,
$globaloptions = '',
$omapi_port = undef,
) {

if $dnsdomain == undef {
Expand Down
37 changes: 37 additions & 0 deletions spec/classes/dhcp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,43 @@
end
end

context 'header' do
let :params do
default_params.merge({
:interfaces => ['eth0'],
})
end

it 'defines dhcp header contents' do
verify_concat_fragment_exact_contents(subject, 'dhcp-conf-header', [
'authoritative;',
'default-lease-time 3600;',
'max-lease-time 86400;',
'log-facility daemon;',
'option domain-name "sampledomain.com";',
'option domain-name-servers 1.1.1.1;',
'option fqdn.no-client-update on; # set the "O" and "S" flag bits',
'option fqdn.rcode2 255;',
'option pxegrub code 150 = text;',
])
end

context 'omapi_port => 7911' do
let :params do
default_params.merge({
:interfaces => ['eth0'],
:omapi_port => 7911,
})
end

it 'defines dhcp header contents' do
verify_concat_fragment_contents(subject, 'dhcp-conf-header', [
'omapi-port 7911;',
])
end
end
end

context 'ntp' do
let :params do
default_params.merge({
Expand Down
14 changes: 14 additions & 0 deletions spec/lib/module_spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def verify_concat_fragment_contents(subject, title, expected_lines)
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
(content.split("\n") & expected_lines).should == expected_lines
end

def verify_concat_fragment_exact_contents(subject, title, expected_lines)
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }.should == expected_lines
end

def verify_exact_contents(subject, title, expected_lines)
content = subject.resource('file', title).send(:parameters)[:content]
content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }.should == expected_lines
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
require 'puppetlabs_spec_helper/module_spec_helper'
require 'lib/module_spec_helper'
3 changes: 3 additions & 0 deletions templates/dhcpd.conf-header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# dhcpd.conf
# ----------
authoritative;
<% if @omapi_port -%>
omapi-port <%= @omapi_port %>;
<% end -%>
default-lease-time <%= @default_lease_time %>;
max-lease-time <%= @max_lease_time %>;
log-facility <%= @logfacility %>;
Expand Down

0 comments on commit eceacaa

Please sign in to comment.