Class Puppet::Network::AuthStore::Declaration
In: lib/puppet/network/authstore.rb
Parent: Object

A single declaration. Stores the info for a given declaration, provides the methods for determining whether a declaration matches, and handles sorting the declarations appropriately.

Methods

<=>   deny?   exact?   interpolate   ip?   match?   new   pattern=   result   to_s   type=  

Included Modules

Puppet::Util Comparable

Constants

Octet = '(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])'   Parse our input pattern and figure out what kind of allowal statement it is. The output of this is used for later matching.
IPv4 = "#{Octet}\.#{Octet}\.#{Octet}\.#{Octet}"
IPv6_full = "_:_:_:_:_:_:_:_|_:_:_:_:_:_::_?|_:_:_:_:_::((_:)?_)?|_:_:_:_::((_:){0,2}_)?|_:_:_::((_:){0,3}_)?|_:_::((_:){0,4}_)?|_::((_:){0,5}_)?|::((_:){0,6}_)?"
IPv6_partial = "_:_:_:_:_:_:|_:_:_:_::(_:)?|_:_::(_:){0,2}|_::(_:){0,3}"
IP = "#{IPv4}|#{IPv6_full}".gsub(/_/,'([0-9a-fA-F]{1,4})').gsub(/\(/,'(?:')   It should be:
    IP = "#{IPv4}|#{IPv6_full}|(#{IPv6_partial}#{IPv4})".gsub(/_/,'([0-9a-fA-F]{1,4})').gsub(/\(/,'(?:')

but ruby‘s ipaddr lib doesn‘t support the hybrid format

Attributes

length  [RW]  The length. Only used for iprange and domain.
name  [RW]  The name: :ip or :domain
pattern  [R]  The pattern we‘re matching against. Can be an IPAddr instance, or an array of strings, resulting from reversing a hostname or domain name.
type  [R]  The type of declaration: either :allow or :deny

Public Class methods

Public Instance methods

Sort the declarations most specific first.

interpolate a pattern to replace any backreferences by the given match for instance if our pattern is $1.reductivelabs.com and we‘re called with a MatchData whose capture 1 is puppet we‘ll return a pattern of puppet.reductivelabs.com

Are we an IP type?

Does this declaration match the name/ip combo?

Set the pattern appropriately. Also sets the name and length.

Mapping a type of statement into a return value.

Set the declaration type. Either :allow or :deny.

[Validate]