When running an older version of Ruby that has
an old version of ipaddr this function fails with
a uninitialized constant IPAddr::AddressFamilyError
error.
This can happen if you are for example running this
code from inside a Puppetserver that runs under JRuby
that has an older version of ipaddr.
This adds a check if one of the classes that was introduced
to replace the ArgumentError exception is present and customizes
the exceptions we catch based on that.
Change-Id: I9948d4dc22195300cf1c0a48fcc0694bcf991698