Sha256: 183f8b467e57a0c36ffbf657073dd6b927cce6cca94cac4a890ba8fca361f956
Contents?: true
Size: 695 Bytes
Versions: 2
Compression:
Stored size: 695 Bytes
Contents
require "puppet_factset/version" require "json" module PuppetFactset # Return the name of the directory holding the factsets def self.factset_dir File.expand_path(File.join(File.dirname(__FILE__), '..', 'res', 'factset')) end # Load factset json file and return a hash def self.factset_hash(factset_name) data = JSON.parse(File.read(File.join(factset_dir(), "#{factset_name}.json"))) # The facts are tucked away inside the 'values' element so just return that data["values"] end # List the available factsets, sorted A-Z def self.factsets() Dir.glob(File.join(factset_dir, '*.json')).map { |f| File.basename(f).gsub('.json','') }.sort end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet_factset-0.3.0 | lib/puppet_factset.rb |
puppet_factset-0.2.1 | lib/puppet_factset.rb |