theforeman/foreman · error · ProxyAPI::ProxyException

Unable to retrieve DHCP subnet

Error message

Unable to retrieve DHCP subnet

What it means

Error "Unable to retrieve DHCP subnet" thrown in theforeman/foreman.

Source

Thrown at app/services/proxy_api/dhcp.rb:20

  class DHCP < ProxyAPI::Resource
    def initialize(args)
      @url = args[:url] + "/dhcp"
      super args
    end

    # Retrieve the Server's subnets
    # Returns: Array of Hashes or false
    # Example [{"network":"192.168.11.0","netmask":"255.255.255.0"},{"network":"192.168.122.0","netmask":"255.255.255.0"}]
    def subnets
      parse get
    rescue => e
      raise ProxyException.new(url, e, N_("Unable to retrieve DHCP subnets"))
    end

    def subnet(subnet)
      parse get(subnet)
    rescue => e
      raise ProxyException.new(url, e, N_("Unable to retrieve DHCP subnet"))
    end

    def unused_ip(subnet, mac = nil)
      params = {}
      params[:mac] = mac if mac.present?

      if subnet.from.present? && subnet.to.present?
        params[:from] = subnet.from
        params[:to] = subnet.to
      end
      if params.any?
        params = params.map { |e| e.join("=") }.join("&")
      else
        params = ""
      end
      parse get("#{subnet.network}/unused_ip", query: params)
    rescue => e
      raise ProxyException.new(url, e, N_("Unable to retrieve unused IP"))

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/services/proxy_api/dhcp.rb:20 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/621f4179dd6dd871. Report an issue: GitHub.