Skip to content

Commit

Permalink
Add check for params dhcp_subnets
Browse files Browse the repository at this point in the history
Add new variable in params dhcp_subnets
Set dhcp_subnets accordingly via template dhcp.yml.erb
Fixes theforemanGH-109
  • Loading branch information
andrei693 committed Apr 22, 2016
1 parent 152cacf commit 570fde1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions templates/dhcp.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
:server: <%= scope.lookupvar("foreman_proxy::dhcp_server") %>
# subnets restricts the subnets queried to a subset, to reduce the query time.
<% if subnets = scope.lookupvar("foreman_proxy::dhcp_subnets") and subnets.any? -%>
:dhcp_subnets:
<% subnets.each do |s| -%>
<%= " - #{s}" %>
:subnets:
<% subnets.each do |c| -%>
<%= " - #{c}" %>
<% end -%>
<% else -%>
#:subnets: [ 192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128 ]
<% end -%>
<% else -%>
<% if scope.lookupvar("foreman_proxy::dhcp") == true -%>
:dhcp_vendor: <%= scope.lookupvar("foreman_proxy::dhcp_provider_real") %>
Expand All @@ -27,10 +29,12 @@
# subnets restricts the subnets queried to a subset, to reduce the query time.
<% if subnets = scope.lookupvar("foreman_proxy::dhcp_subnets") and subnets.any? -%>
:dhcp_subnets:
<% subnets.each do |s| -%>
<%= " - #{s}" %>
<% subnets.each do |c| -%>
<%= " - #{c}" %>
<% end -%>
<% else -%>
#:subnets: [ 192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128 ]
<% end -%>
#:subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]
<% unless [nil, :undefined, :undef, ''].include?(scope.lookupvar("foreman_proxy::dhcp_key_name")) ||
[nil, :undefined, :undef, ''].include?(scope.lookupvar("foreman_proxy::dhcp_key_secret")) -%>
:dhcp_key_name: <%= scope.lookupvar("foreman_proxy::dhcp_key_name") %>
Expand Down

0 comments on commit 570fde1

Please sign in to comment.