Class: Puppetx::Puppet::Hiera2Backend Abstract
- Defined in:
- lib/puppetx/puppet/hiera2_backend.rb
Overview
Hiera2Backend is a Puppet Extension Point for the purpose of extending Puppet with a hiera data compatible backend. The intended use is to create a class derived from this class and then register it with the Puppet Binder under a backend name in the binder_config.yaml file to map symbolic name to class name.
The responsibility of a Hiera2 backend is minimal. It should read the given file (with some extesion(s) determined by the backend, and return a hash of the content. If the directory does not exist, or the file does not exist an empty hash should be produced.
Direct Known Subclasses
Puppet::Pops::Binder::Hiera2::JsonBackend, Puppet::Pops::Binder::Hiera2::YamlBackend
Instance Method Summary collapse
-
#read_data(directory, file_name) ⇒ Hash<String, Object>, Hash<Symbol, Object>
Produces a hash with data read from the file in the given directory having the given file_name (with extensions appended under the discretion of this backend).
Instance Method Details
#read_data(directory, file_name) ⇒ Hash<String, Object>, Hash<Symbol, Object>
Produces a hash with data read from the file in the given directory having the given file_name (with extensions appended under the discretion of this backend).
Should return an empty hash if the directory or the file does not exist. May raise exception on other types of errors, but not return nil.
27 28 29 |
# File 'lib/puppetx/puppet/hiera2_backend.rb', line 27 def read_data(directory, file_name) raise NotImplementedError, "The class #{self.class.name} should have implemented the method 'read_data(directory, file_name)'" end |