Sha256: 8066e3db11c2ca5c936d90b27253bd69fd2498cee96be576c0f6b9c88caf7643

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

# A module to gather vlan facts
#
module Facter::Util::Vlans
    def self.get_vlan_config
        output = ""
            if File.exists?('/proc/net/vlan/config') and File.readable?('/proc/net/vlan/config')
                output = File.open('/proc/net/vlan/config').read
            end
        output
    end

    def self.get_vlans
        vlans = Array.new
        if self.get_vlan_config
            self.get_vlan_config.each do |line|
                if line =~ /^([0-9A-Za-z]+)\.([0-9]+) /
                    vlans.insert(-1, $~[2]) if $~[2]
                end
            end
        end

        vlans.join(',')
    end
end   

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facter-1.5.8 lib/facter/util/vlans.rb