[Pkg-puppet-devel] [facter] 37/61: Maint: Update yardocs

Stig Sandbeck Mathisen ssm at debian.org
Mon Nov 4 15:02:00 UTC 2013


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit abf0d0853874700cb119221d3568e8574e009e6d
Author: Josh Cooper <josh at puppetlabs.com>
Date:   Wed Jul 24 23:36:01 2013 -0700

    Maint: Update yardocs
    
    Updated yardocs where appropriate. Also changed the predicate methods to
    return a boolean instead of String or nil.
---
 lib/facter/util/ip/windows.rb |   38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/lib/facter/util/ip/windows.rb b/lib/facter/util/ip/windows.rb
index 7c5aba3..0881ecb 100644
--- a/lib/facter/util/ip/windows.rb
+++ b/lib/facter/util/ip/windows.rb
@@ -10,6 +10,9 @@ class Facter::Util::IP::Windows
   # @api private
   WMI_IP_INFO_QUERY = 'SELECT Description, ServiceName, IPAddress, IPConnectionMetric, InterfaceIndex, Index, IPSubnet, MACAddress, MTU, SettingID FROM Win32_NetworkAdapterConfiguration WHERE IPConnectionMetric IS NOT NULL AND IPEnabled = TRUE'
 
+  # Mapping fact names to WMI properties of the Win32_NetworkAdapterConfiguration
+  #
+  # @api private
   WINDOWS_LABEL_WMI_MAP = {
       :ipaddress => 'IPAddress',
       :ipaddress6 => 'IPAddress',
@@ -32,7 +35,7 @@ class Facter::Util::IP::Windows
 
   # Retrieves a list of unique interfaces names.
   #
-  # @return [Array]
+  # @return [Array<String>]
   #
   # @api private
   def self.interfaces
@@ -50,8 +53,9 @@ class Facter::Util::IP::Windows
   # Get the value of an interface and label. For example, you may want to find
   # the MTU for eth0.
   #
-  # @param interface [String] label [String]
-  # @return [String] or [NilClass]
+  # @param [String] interface the name of the interface returned by the {#interfaces} method.
+  # @param [String] label the type of value to return, e.g. ipaddress
+  # @return [String] the value, or nil if not defined
   #
   # @api private
   def self.value_for_interface_and_label(interface, label)
@@ -84,14 +88,14 @@ class Facter::Util::IP::Windows
     label_value
   end
 
-  # Executes a wmi query that returns ip information and returns for each item in the results
+  # Returns an array of partial Win32_NetworkAdapterConfiguration objects.
   #
-  # @return [Win32OLE] objects
+  # @return [Array<WIN32OLE>] objects
   #
   # @api private
   def self.network_adapter_configurations
     nics = []
-    # Win32OLE doesn't implement Enumerable
+    # WIN32OLE doesn't implement Enumerable
     Facter::Util::WMI.execquery(WMI_IP_INFO_QUERY).each do |nic|
       nics << nic
     end
@@ -103,7 +107,7 @@ class Facter::Util::IP::Windows
   # then the IPv4 specific binding order as specified in the registry will
   # be used.
   #
-  # return [Array<Win32OLE>]
+  # @return [Array<WIN32OLE>]
   #
   # @api private
   def self.get_preferred_ipv4_adapters
@@ -115,7 +119,7 @@ class Facter::Util::IP::Windows
   # then the IPv6 specific binding order as specified in the registry will
   # be used.
   #
-  # return [Array<Win32OLE>]
+  # @return [Array<WIN32OLE>]
   #
   # @api private
   def self.get_preferred_ipv6_adapters
@@ -128,7 +132,7 @@ class Facter::Util::IP::Windows
   # Note the order may different for IPv4 vs IPv6 addresses.
   #
   # @see http://support.microsoft.com/kb/894564
-  # @return [Array<Win32OLE>]
+  # @return [Array<WIN32OLE>]
   #
   # @api private
   def self.get_preferred_network_adapters(bindings)
@@ -170,8 +174,8 @@ class Facter::Util::IP::Windows
 
   # Determines if the value passed in is a valid ipv4 address.
   #
-  # @param ip_address [String]
-  # @return [String] or [NilClass]
+  # @param [String] ip_address the IPv4 address to validate
+  # @return [Boolean]
   #
   # @api private
   def self.valid_ipv4_address?(ip_address)
@@ -180,27 +184,27 @@ class Facter::Util::IP::Windows
       #  meaning that if the node cannot get an ip address from the dhcp server,
       #  it auto-assigns a private ip address
       unless match == "127.0.0.1" or match =~ /^169.254.*/
-        return match
+        return !!match
       end
     end
 
-    nil
+    false
   end
 
   # Determines if the value passed in is a valid ipv6 address.
   #
-  # @param ip_address [String]
-  # @return [String] or [NilClass]
+  # @param [String] ip_address the IPv6 address to validate
+  # @return [Boolean]
   #
   # @api private
   def self.valid_ipv6_address?(ip_address)
     String(ip_address).scan(/(?>[0-9,a-f,A-F]*\:{1,2})+[0-9,a-f,A-F]{0,4}/).each do |match|
       unless match =~ /fe80.*/ or match == "::1"
-        return match
+        return !!match
       end
     end
 
-    nil
+    false
   end
 
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list