Skip to content

Commit

Permalink
use .present? (theforeman#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoll authored and ares committed Aug 14, 2017
1 parent c7d21be commit ceb551f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions snippets/coreos_cloudconfig.erb
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ name: coreos_cloudconfig
[Match]
MACAddress=<%= @host.mac %>
[Network]
<% if !@host.subnet.gateway.nil? && !@host.subnet.gateway.empty? -%>
<% if @host.subnet.present? -%>
Gateway=<%= @host.subnet.gateway %>
<% end -%>
Address=<%= @host.ip %>/<%= @host.subnet.cidr %>
<% if !@host.subnet.dns_primary.nil? && !@host.subnet.dns_primary.empty? -%>
<% if @host.subnet.dns_primary.present? -%>
DNS=<%= @host.subnet.dns_primary %>
<% end -%>
<% if !@host.subnet.dns_secondary.nil? && !@host.subnet.dns_secondary.empty? -%>
<% if @host.subnet.dns_secondary.present? -%>
DNS=<%= @host.subnet.dns_secondary %>
<% end -%>
- name: down-interfaces.service
Expand Down
10 changes: 5 additions & 5 deletions snippets/kickstart_networking_setup.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BOOTPROTO="<%= dhcp ? 'dhcp' : 'none' -%>"
<% unless dhcp -%>
IPADDR="<%= @host.ip -%>"
NETMASK="<%= subnet.mask -%>"
<% if !subnet.gateway.nil? && !subnet.gateway.empty? -%>
<% if subnet.gateway.present? -%>
GATEWAY="<%= subnet.gateway %>"
<% end -%>
<% end -%>
Expand All @@ -42,7 +42,7 @@ BOOTPROTO="<%= dhcp ? 'dhcp' : 'none' -%>"
<% unless dhcp || subnet.nil? -%>
IPADDR="<%= bond.ip -%>"
NETMASK="<%= subnet.mask -%>"
<% if !subnet.gateway.nil? && !subnet.gateway.empty? -%>
<% if subnet.gateway.present? -%>
GATEWAY="<%= subnet.gateway %>"
<% end -%>
<% end -%>
Expand Down Expand Up @@ -130,7 +130,7 @@ BOOTPROTO="<%= dhcp ? 'dhcp' : 'none' -%>"
<% unless dhcp -%>
IPADDR="<%= interface.ip -%>"
NETMASK="<%= subnet.mask -%>"
<% if !subnet.gateway.nil? && !subnet.gateway.empty? -%>
<% if subnet.gateway.present? -%>
GATEWAY="<%= subnet.gateway %>"
<% end -%>
<% end -%>
Expand All @@ -142,9 +142,9 @@ ONBOOT=yes
<% if interface.respond_to?(:primary) && interface.primary -%>
PEERDNS=yes
PEERROUTES=yes
<% if !dhcp && !subnet.dns_primary.nil? && !subnet.dns_primary.empty? -%>
<% if !dhcp && subnet.dns_primary.present? -%>
DNS1=<%= subnet.dns_primary %>
<% if !subnet.dns_secondary.nil? && !subnet.dns_secondary.empty? -%>
<% if subnet.dns_secondary.present? -%>
DNS2=<%= subnet.dns_secondary %>
<% end -%>
<% end -%>
Expand Down
6 changes: 3 additions & 3 deletions xenserver/provision.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ oses:
<% unless dhcp -%>
<ip><%= @host.ip %></ip>
<subnet-mask><%= subnet.mask %></subnet-mask>
<% if !subnet.gateway.nil? && !subnet.gateway.empty? -%>
<% if subnet.gateway.present? -%>
<gateway><%= subnet.gateway %></gateway>
<% end -%>
<% end -%>
</admin-interface>
<% if !subnet.dns_primary.nil? && !subnet.dns_primary.empty? -%>
<% if subnet.dns_primary.present? -%>
<name-server><%= subnet.dns_primary %></name-server>
<% end -%>
<% if !subnet.dns_secondary.nil? && !subnet.dns_secondary.empty? -%>
<% if subnet.dns_secondary.present? -%>
<name-server><%= subnet.dns_secondary %></name-server>
<% end -%>
<ntp-server><%= @host.params['ntp-server'] || 'pool.ntp.org' %></ntp-server>
Expand Down

0 comments on commit ceb551f

Please sign in to comment.