Module | Hiera::Backend |
In: |
lib/hiera/backend/json_backend.rb
lib/hiera/backend/yaml_backend.rb lib/hiera/backend.rb |
Data lives in /var/lib/hiera by default. If a backend supplies a datadir in the config it will be used and subject to variable expansion based on scope
Finds the path to a datafile based on the Backend#datadir and extension
If the file is not found nil is returned
Constructs a list of data files to search
If you give it a specific hierarchy it will just use that else it will use the global configured one, failing that it will just look in the ‘common’ data source.
An override can be supplied that will be pre-pended to the hierarchy.
The source names will be subject to variable expansion based on scope
Only files that exist will be returned. If the file is missing, then the block will not receive the file.
@yield [String, String] the source string and the name of the resulting file @api public
Constructs a list of data sources to search
If you give it a specific hierarchy it will just use that else it will use the global configured one, failing that it will just look in the ‘common’ data source.
An override can be supplied that will be pre-pended to the hierarchy.
The source names will be subject to variable expansion based on scope
@param key [String] The key to lookup. May be quoted with single or double quotes to avoid subkey traversal on dot characters @param scope [#[]] The primary source of data for substitutions. @param order_override [#[],nil] An override that will be pre-pended to the hierarchy definition. @param resolution_type [Symbol,Hash,nil] One of :hash, :array,:priority or a Hash with deep merge behavior and options @param context [#[]] Context used for internal processing @return [Object] The value that corresponds to the given key or nil if no such value cannot be found
Merges two hashes answers with the given or configured merge behavior. Behavior can be given by passing resolution_type as a Hash
:merge_behavior: {:native|:deep|:deeper}
Deep merge options use the Hash utility function provided by [deep_merge](github.com/danielsdeleo/deep_merge) It uses the compatibility mode [deep_merge](github.com/danielsdeleo/deep_merge#using-deep_merge-in-rails)
:native => Native Hash.merge :deep => Use Hash.deeper_merge :deeper => Use Hash.deeper_merge!
@param left [Hash] left side of the merge @param right [Hash] right side of the merge @param resolution_type [String,Hash] The merge type, or if hash, the merge behavior and options @return [Hash] The merged result @see Hiera#lookup
Parses a answer received from data files
Ultimately it just pass the data through parse_string but it makes some effort to handle arrays of strings as well
Parse a string like ’%{foo}’ against a supplied scope and additional scope. If either scope or extra_scope includes the variable ‘foo’, then it will be replaced else an empty string will be placed.
If both scope and extra_data has "foo", then the value in scope will be used.
@param data [String] The string to perform substitutions on.
This will not be modified, instead a new string will be returned.
@param scope [#[]] The primary source of data for substitutions. @param extra_data [#[]] The secondary source of data for substitutions. @param context [#[]] Context can include :recurse_guard and :order_override. @return [String] A copy of the data with all instances of %{…} replaced.
@api public