{"record":{"id":"f314206703d1a6c9","repo":"theforeman/foreman","slug":"unable-to-retrieve-dhcp-subnets","errorCode":null,"errorMessage":"Unable to retrieve DHCP subnets","messagePattern":"Unable to retrieve DHCP subnets","errorType":"exception","errorClass":"ProxyAPI::ProxyException","httpStatus":null,"severity":"error","filePath":"app/services/proxy_api/dhcp.rb","lineNumber":14,"sourceCode":"module ProxyAPI\n  class DHCP < ProxyAPI::Resource\n    def initialize(args)\n      @url = args[:url] + \"/dhcp\"\n      super args\n    end\n\n    # Retrieve the Server's subnets\n    # Returns: Array of Hashes or false\n    # Example [{\"network\":\"192.168.11.0\",\"netmask\":\"255.255.255.0\"},{\"network\":\"192.168.122.0\",\"netmask\":\"255.255.255.0\"}]\n    def subnets\n      parse get\n    rescue => e\n      raise ProxyException.new(url, e, N_(\"Unable to retrieve DHCP subnets\"))\n    end\n\n    def subnet(subnet)\n      parse get(subnet)\n    rescue => e\n      raise ProxyException.new(url, e, N_(\"Unable to retrieve DHCP subnet\"))\n    end\n\n    def unused_ip(subnet, mac = nil)\n      params = {}\n      params[:mac] = mac if mac.present?\n\n      if subnet.from.present? && subnet.to.present?\n        params[:from] = subnet.from\n        params[:to] = subnet.to\n      end\n      if params.any?\n        params = params.map { |e| e.join(\"=\") }.join(\"&\")","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/proxy_api/dhcp.rb#L1-L32","documentation":"Error \"Unable to retrieve DHCP subnets\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/proxy_api/dhcp.rb:14 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}