Revert "Add old ruby support to inet6_prefix"
This reverts commitefffd27a41
. Reason for revert: The logic was added to support ruby 1.x which does not contain [1], but recent operating systems no longer ship such an old version. CentOS 9: Ruby 3.0 CentOS 8: Ruby 2.5 Ubuntu 20.04: Ruby 2.7 [1]e03d266c1d
Change-Id: I7c633f8d12e4678910872b7782273b2ca2c76d65
This commit is contained in:
@@ -8,15 +8,6 @@ Puppet::Functions.create_function(:inet6_prefix) do
|
|||||||
def inet6_prefix(*args)
|
def inet6_prefix(*args)
|
||||||
require 'ipaddr'
|
require 'ipaddr'
|
||||||
|
|
||||||
# NOTE(tobias-urdin): Add support for older version of the ipaddr
|
|
||||||
# lib where ArgumentError hasn't been replaced yet.
|
|
||||||
if IPAddr.const_defined?('InvalidAddressError')
|
|
||||||
exp = [IPAddr::AddressFamilyError, IPAddr::Error, IPAddr::InvalidAddressError,
|
|
||||||
IPAddr::InvalidPrefixError, ArgumentError, NoMethodError]
|
|
||||||
else
|
|
||||||
exp = [ArgumentError, NoMethodError]
|
|
||||||
end
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
args = args[0] if args[0].kind_of?(Array)
|
args = args[0] if args[0].kind_of?(Array)
|
||||||
args = [args] unless args.kind_of?(Array)
|
args = [args] unless args.kind_of?(Array)
|
||||||
@@ -29,7 +20,7 @@ Puppet::Functions.create_function(:inet6_prefix) do
|
|||||||
ip = "inet6:[#{ip_parts.shift}]#{ip_parts.join}"
|
ip = "inet6:[#{ip_parts.shift}]#{ip_parts.join}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue *exp
|
rescue IPAddr::AddressFamilyError, IPAddr::Error, IPAddr::InvalidAddressError, IPAddr::InvalidPrefixError, ArgumentError, NoMethodError => e
|
||||||
# ignore it
|
# ignore it
|
||||||
end
|
end
|
||||||
result << ip
|
result << ip
|
||||||
|
Reference in New Issue
Block a user