From c4c5372851105ed8c3805d60f177fc32daf195b3 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 25 Aug 2022 10:33:04 +0900 Subject: [PATCH] Remove wrong TODO comment The IPAddr.new().prefix function does not work as intended. This change removes the TODO comment to use the function because we can't really replace the current implementation by that built-in feature. irb(main):001:0> IPAddr.new('ffff:ffff:ffff:ffff::').to_i.to_s(2).count("1") => 64 irb(main):002:0> IPAddr.new('ffff:ffff:ffff:ffff::').prefix => 128 Change-Id: I07a340e1716f6ab8db718b89bf4535f989df7929 --- lib/puppet/functions/ipv6_normalize_dnsmasq_ip_subnets.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/puppet/functions/ipv6_normalize_dnsmasq_ip_subnets.rb b/lib/puppet/functions/ipv6_normalize_dnsmasq_ip_subnets.rb index c3261757..978d213a 100644 --- a/lib/puppet/functions/ipv6_normalize_dnsmasq_ip_subnets.rb +++ b/lib/puppet/functions/ipv6_normalize_dnsmasq_ip_subnets.rb @@ -7,8 +7,6 @@ Puppet::Functions.create_function(:ipv6_normalize_dnsmasq_ip_subnets) do begin if ip_subnet["netmask"] if IPAddr.new(ip_subnet["netmask"]).ipv6? - # TODO(hjensas) Once we have ruby stdlib >= 2.5.x we can use - # IPAddr.new().prefix instead of counting 1's. prefix = IPAddr.new(ip_subnet["netmask"]).to_i.to_s(2).count("1") Puppet.debug("Netmask #{ip_subnet["netmask"]} changed to prefix #{prefix}") ip_subnet_dup["netmask"] = prefix