diff --git a/dhcpd/files/dhcpd.conf b/dhcpd/files/dhcpd.conf index a4078c9..8c63c4c 100644 --- a/dhcpd/files/dhcpd.conf +++ b/dhcpd/files/dhcpd.conf @@ -170,6 +170,20 @@ option {{ option|replace('_', '-') }} {{ quote }}{{ dhcpd.get(option) }}{{ quote {%- endif %} {%- endfor %} +{#- ### Option related macro ### #} +{%- macro print_option(option, value) %} + {%- if option == 'next-server' %} + next-server {{ value }}; + {%- endif %} + {%- if option == 'filename' %} + filename "{{ value }}"; + {%- endif %} + {%- if option in dhcpd.customized_options.keys() %} + {%- if dhcpd.customized_options[option]['type'] in types_to_quote %} {% set quote = dquote %} {%- endif %} + option {{ option|replace('_', '-') }} {{ quote }}{{ value }}{{ quote }}; + {%- endif %} +{%- endmacro %} + {%- for class, config in dhcpd.classes.items() %} {%- if 'comment' in config %} {%- for line in config.comment.splitlines() %} @@ -180,11 +194,8 @@ class "{{ class }}" { {%- if 'match' in config %} match {{ config.match }}; {%- endif %} - {%- for option in dhcpd.customized_options.keys() %} - {%- if option in config %} - {%- if dhcpd.customized_options[option]['type'] in types_to_quote %} {% set quote = dquote %} {%- endif %} - option {{ option|replace('_', '-') }} {{ quote }}{{ config.get(option) }}{{ quote }}; - {%- endif %} + {%- for option in config %} + {{- print_option(option, config.get(option)) }} {%- endfor %} } {%- endfor %}