Sha256: 04d07081a6970f8784474b4f4296f9d8c3339b2009110075be718d0b6bdcf2d1

Contents?: true

Size: 728 Bytes

Versions: 14

Compression:

Stored size: 728 Bytes

Contents

require 'hocon'
require 'hocon/config_syntax'
require 'puppet/util/network_device/base'

module Puppet::Util::NetworkDevice::Simple
  # A basic device class, that reads its configuration from the provided URL.
  # The URL has to be a local file URL.
  class Device
    def initialize(url, _options = {})
      @url = URI.parse(url)
      raise "Unexpected url '#{url}' found. Only file:/// URLs for configuration supported at the moment." unless @url.scheme == 'file'
    end

    def facts
      {}
    end

    def config
      raise "Trying to load config from '#{@url.path}, but file does not exist." unless File.exist? @url.path
      @config ||= Hocon.load(@url.path, syntax: Hocon::ConfigSyntax::HOCON)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
puppet-resource_api-1.3.0 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-1.2.0 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-1.1.0 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-1.0.3 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-1.0.2 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-1.0.1 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-1.0.0 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-0.10.0 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-0.9.0 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-0.3.0 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-0.2.2 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-0.2.1 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-0.2.0 lib/puppet/util/network_device/simple/device.rb
puppet-resource_api-0.1.0 lib/puppet/util/network_device/simple/device.rb