Skip to content

Commit

Permalink
fix(dhcpd.conf): fix bug 50
Browse files Browse the repository at this point in the history
* Fix #50
  • Loading branch information
myii committed Sep 23, 2020
1 parent cf4decb commit e015cda
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
22 changes: 14 additions & 8 deletions dhcpd/files/dhcpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,23 @@ use-host-decl-names on;
{%- endif %}

{%- if dhcpd.allow %}
{%- if dhcpd.allow is iterable and dhcpd.allow is not string %}
{%- for item in dhcpd.allow %}allow {{ item }};{%- endfor %}
{%- else %}allow {{ dhcpd.allow }};
{%- endif %}
{%- if dhcpd.allow is iterable and dhcpd.allow is not string %}
{%- for item in dhcpd.allow %}
allow {{ item }};
{%- endfor %}
{%- else %}
allow {{ dhcpd.allow }};
{%- endif %}
{%- endif %}

{%- if dhcpd.deny %}
{%- if dhcpd.deny is iterable and dhcpd.deny is not string %}
{%- for item in dhcpd.deny %}deny {{ item }};{%- endfor %}
{%- else %}deny {{ dhcpd.deny }};
{%- endif %}
{%- if dhcpd.deny is iterable and dhcpd.deny is not string %}
{%- for item in dhcpd.deny %}
deny {{ item }};
{%- endfor %}
{%- else %}
deny {{ dhcpd.deny }};
{%- endif %}
{%- endif %}

# LDAP Backend Configuration
Expand Down
4 changes: 4 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ dhcpd:
lookup:
enable: false

allow:
- booting
- bootp
deny: unknown-clients
domain_name: example.org
domain_name_servers:
- ns1.example.org
Expand Down
3 changes: 3 additions & 0 deletions test/integration/default/controls/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
max-lease-time 7200;
#use-host-decl-names off;
allow booting;
allow bootp;
deny unknown-clients;
# LDAP Backend Configuration
Expand Down
6 changes: 4 additions & 2 deletions test/integration/default/controls/yaml_dump_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

arch = 'amd64'
common01 = <<~COMMON.chomp
allow: []
allow:
- booting
- bootp
arch: #{arch}
authoritative: false
classes:
Expand All @@ -27,7 +29,7 @@
ddns_domainname: ''
ddns_update_style: ''
default_lease_time: 600
deny: []
deny: unknown-clients
domain_name: example.org
domain_name_servers:
- ns1.example.org
Expand Down

0 comments on commit e015cda

Please sign in to comment.