Module: Facter::Util::Vlans
- Defined in:
- lib/facter/util/vlans.rb
Overview
A module to gather vlan facts
Class Method Summary collapse
Class Method Details
.get_vlan_config ⇒ Object
4 5 6 7 8 |
# File 'lib/facter/util/vlans.rb', line 4 def self.get_vlan_config if File.exist?('/proc/net/vlan/config') and File.readable?('/proc/net/vlan/config') File.read('/proc/net/vlan/config') end end |
.get_vlans ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/facter/util/vlans.rb', line 10 def self.get_vlans if (config = self.get_vlan_config) vlans = [] config.each_line do |line| if (match = line.match(/^([0-9A-Za-z]+)\.([0-9]+) /)) vlans << match[2] if match[2] end end vlans.join(',') unless vlans.empty? end end |