From 779c96bc49b303f364954c6b942a2824d0995343 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami <tkajinam@redhat.com> Date: Thu, 24 Nov 2022 12:16:48 +0900 Subject: [PATCH] inet6_prefix: Simplify exception handling The following exceptions all inherit IPAddr::Error, which inherits ArgumentError. - IPAddr::AddressFamilyError - IPAddr::InvalidAddressError - IPAddr::InvalidPrefixError Because we use the same logic for all of these exceptions, we can just catch the base ArgumentError instead of listing all these separately. Change-Id: Ie88fce429e1b73a89820a94e8635ed6ad906b07f --- lib/puppet/functions/inet6_prefix.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/functions/inet6_prefix.rb b/lib/puppet/functions/inet6_prefix.rb index 6af2ceeb..a6b9c525 100644 --- a/lib/puppet/functions/inet6_prefix.rb +++ b/lib/puppet/functions/inet6_prefix.rb @@ -20,7 +20,7 @@ Puppet::Functions.create_function(:inet6_prefix) do ip = "inet6:[#{ip_parts.shift}]#{ip_parts.join}" end end - rescue IPAddr::AddressFamilyError, IPAddr::Error, IPAddr::InvalidAddressError, IPAddr::InvalidPrefixError, ArgumentError, NoMethodError => e + rescue ArgumentError, NoMethodError => e # ignore it end result << ip