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