[PATCH/foreman 1/1] fixes #1381 - nextServer should be handled internally as an IP address not a hostname

Signed-off-by: Paul Kelly <paul.ian.kelly@googlemail.com>

··· --- app/models/orchestration/dhcp.rb | 2 +- lib/net/dns.rb | 4 ++-- lib/proxy_api.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/models/orchestration/dhcp.rb b/app/models/orchestration/dhcp.rb
index 7f83fda…ac07ad3 100644
— a/app/models/orchestration/dhcp.rb
+++ b/app/models/orchestration/dhcp.rb
@@ -77,7 +77,7 @@ module Orchestration::DHCP
# trying to guess out tftp next server based on the smart proxy hostname
bs = URI.parse(subnet.tftp.url).host if respond_to?(:tftp?) and tftp?
end

  •  return bs unless bs.blank?
    
  •  return(bs =~/^\d/ ? bs : dns_ptr_record.dns_lookup(bs).ip) unless bs.blank?
     failure "Unable to determine the host's boot server. The DHCP smart proxy failed to provide this information and this subnet is not provided with TFTP services."
    
    rescue => e
    failure "failed to detect boot server: #{e}"
    diff --git a/lib/net/dns.rb b/lib/net/dns.rb
    index 5d78b8d…5184459 100644
    — a/lib/net/dns.rb
    +++ b/lib/net/dns.rb
    @@ -61,12 +61,12 @@ module Net
    raise "Abstract class"
    end
  •  protected
    
  •  def dns_lookup ip_or_name
       DNS.lookup(ip_or_name, proxy, resolver)
     end
    
  •  protected
    
  •  def generate_conflict_error
       logger.warn "Conflicting DNS #{type} record for #{to_s} detected"
       e          = Net::Conflict.new
    

diff --git a/lib/proxy_api.rb b/lib/proxy_api.rb
index 68c0231…359df94 100644
— a/lib/proxy_api.rb
+++ b/lib/proxy_api.rb
@@ -249,7 +249,7 @@ module ProxyAPI
def bootServer
response = parse get(“serverName”)
if response and response[“serverName”] and !response[“serverName”].blank?

  •    return response["serverName"]
    
  •    return(response["serverName"] =~ /^\d/ ? response["serverName"] : dns_ptr_record.dns_lookup(response["serverName"]).ip)
     end
     false
    
    rescue RestClient::ResourceNotFound

    1.7.5.4