]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
(#10274) Document Util::Firewall.host_to_ip
authorDan Carley <dan.carley@gmail.com>
Fri, 25 May 2012 09:24:39 +0000 (10:24 +0100)
committerDan Carley <dan.carley@gmail.com>
Fri, 25 May 2012 20:44:19 +0000 (21:44 +0100)
Document the current behaviour of Util::Firewall.host_to_ip before it is
modified to handle addresses with zero prefix lengths.

lib/puppet/util/firewall.rb

index f376fc22c8d288975509c88e96cd65d0197d6016..21e394d33dba58e1f9f0df00ea83d14bc6f4afa1 100644 (file)
@@ -69,6 +69,21 @@ module Puppet::Util::Firewall
     end
   end
 
+  # Takes an address and returns it in CIDR notation.
+  #
+  # If the address is:
+  #
+  #   - A hostname:
+  #     It will be resolved
+  #   - An IPv4 address:
+  #     It will be qualified with a /32 CIDR notation
+  #   - An IPv6 address:
+  #     It will be qualified with a /128 CIDR notation
+  #   - An IP address with a CIDR notation:
+  #     It will be normalised
+  #   - An IP address with a dotted-quad netmask:
+  #     It will be converted to CIDR notation
+  #
   def host_to_ip(value)
     begin
       Puppet::Util::IPCidr.new(value).cidr