Sha256: d3e14d8dfc861a97a78a4e60e3183e46c2b0ca9fb643308433e0f5f9f2ab35fe
Contents?: true
Size: 786 Bytes
Versions: 7
Compression:
Stored size: 786 Bytes
Contents
# frozen_string_literal: true module Facts module Linux class DhcpServers FACT_NAME = 'dhcp_servers' def call_the_resolver fact_value = construct_addresses_hash fact_value = !fact_value || fact_value.empty? ? nil : fact_value Facter::ResolvedFact.new(FACT_NAME, fact_value, :legacy) end private def construct_addresses_hash primary = Facter::Resolvers::NetworkingLinux.resolve(:primary_interface) interfaces = Facter::Resolvers::NetworkingLinux.resolve(:interfaces) return unless interfaces servers = { system: interfaces[primary][:dhcp] } interfaces&.each { |interface_name, info| servers[interface_name] = info[:dhcp] if info[:dhcp] } servers end end end end
Version data entries
7 entries across 7 versions & 1 rubygems