]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Fix error reporting for insane hostnames.
authorTomas Doran <tomas.doran@timgroup.com>
Tue, 4 Sep 2012 16:04:35 +0000 (17:04 +0100)
committerTomas Doran <tomas.doran@timgroup.com>
Mon, 25 Feb 2013 16:54:44 +0000 (16:54 +0000)
If you put some really silly values in (e.g. /) into hostnames then
the error message s super super cryptic.

This patch fixes that, so it's at least obvious what / where / why it's
failing if you use --trace --debug

lib/puppet/type/firewall.rb

index 942120b531e30d1881e06dfc21991a20ea26025b..e23468566f50e13afba1873c6bad99f7574e766d 100644 (file)
@@ -97,7 +97,11 @@ Puppet::Type.newtype(:firewall) do
     EOS
 
     munge do |value|
-      @resource.host_to_ip(value)
+      begin
+        @resource.host_to_ip(value)
+      rescue Exception => e
+        self.fail("host_to_ip failed for #{value}, exception #{e}")
+      end
     end
   end