# class Puppet::Util::NetworkDevice::Config

### Attributes

devices[R]

### Public Class Methods

devices() click to toggle source

    # File lib/puppet/util/network_device/config.rb, line 11
    def self.devices
      main.devices || []
    end

main() click to toggle source

    # File lib/puppet/util/network_device/config.rb, line 7
    def self.main
      @main ||= self.new
    end

new() click to toggle source
Calls superclass method Puppet::Util::LoadedFile.new

    # File lib/puppet/util/network_device/config.rb, line 21
    def initialize()
      @file = Puppet[:deviceconfig]

      raise Puppet::DevError, "No device config file defined" unless @file
      return unless self.exists?
      super(@file)
      @devices = {}

      read(true) # force reading at start
    end

### Public Instance Methods

exists?() click to toggle source

    # File lib/puppet/util/network_device/config.rb, line 17
    def exists?
      FileTest.exists?(@file)
    end

read(force = false) click to toggle source

Read the configuration file.

    # File lib/puppet/util/network_device/config.rb, line 33
    def read(force = false)
      return unless FileTest.exists?(@file)

      parse if force or changed?
    end