Skip to content

Commit

Permalink
Remove has_variable from templates
Browse files Browse the repository at this point in the history
Without this patch the use of has_variable? in templates are causing
logic errors.  PXE configuration options are being added when they
should not be.

This patch replaces has_variable? with instance variables.  This fixes
the problem and correctly produces templates.

NOTE: The concat module assumes an empty string passed to content is the
same as content being undefined.  As a result, the template fragment
uses a static header comment to always make sure the string is not
empty.
  • Loading branch information
Jeff McCune committed Jun 8, 2012
1 parent 5882af7 commit 02b4d4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions templates/dhcpd.conf-extra.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ----------
# Extra Configs
# ----------
include "<%= dhcp_dir %>/dhcpd.pools";
include "<%= dhcp_dir %>/dhcpd.hosts";
include "<%= @dhcp_dir %>/dhcpd.pools";
include "<%= @dhcp_dir %>/dhcpd.hosts";

12 changes: 5 additions & 7 deletions templates/dhcpd.conf.pxe.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<% if has_variable?( 'pxeserver' ) and has_variable?( 'pxefilename' ) then -%>
# ----------
# PXE Handoff
# ----------
next-server <%= pxeserver %>;
filename "<%= pxefilename %>";
# BEGIN PXE Section
<% if @pxeserver and @pxefilename then -%>
next-server <%= @pxeserver %>;
filename "<%= @pxefilename %>";
<% end -%>

# END PXE Section

0 comments on commit 02b4d4f

Please sign in to comment.