Skip to content

Commit

Permalink
Add support for setting up OMAPI key
Browse files Browse the repository at this point in the history
  • Loading branch information
mrobbert committed Aug 18, 2015
1 parent 1ad54b3 commit f5c06c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
$max_lease_time = 86400,
$dnskeyname = 'rndc-key',
$dnsupdatekey = undef,
$omapi_name = undef,
$omapi_key = undef,
$pxeserver = undef,
$pxefilename = undef,
$logfacility = 'local7',
Expand Down
7 changes: 7 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
let(:params) do {
:interfaces => ['eth0'],
:dnsupdatekey => 'mydnsupdatekey',
:omapi_name => 'mykeyname',
:omapi_key => 'myomapikey',
:pxeserver => '10.0.0.5',
:pxefilename => 'mypxefilename',
:option_static_route => true,
Expand All @@ -58,6 +60,11 @@
it {
verify_concat_fragment_exact_contents(catalogue, 'dhcp.conf+01_main.dhcp', [
'omapi-port 7911;',
'key mykeyname {',
' algorithm HMAC-MD5;',
' secret "myomapikey";',
'}',
'omapi-key mykeyname;',
'default-lease-time 43200;',
'max-lease-time 86400;',
'authoritative;',
Expand Down
7 changes: 7 additions & 0 deletions templates/dhcpd.conf.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# dhcpd.conf
omapi-port 7911;
<% if @omapi_name && @omapi_key -%>
key <%= @omapi_name %> {
algorithm HMAC-MD5;
secret "<%= @omapi_key %>";
}
omapi-key <%= @omapi_name %>;
<% end -%>

default-lease-time <%= @default_lease_time %>;
max-lease-time <%= @max_lease_time %>;
Expand Down

0 comments on commit f5c06c9

Please sign in to comment.