Module: Puppet::Pops::Lookup::LocationResolver Private
- Includes:
- Interpolation
- Included in:
- DataProviders::HieraConfig, HieraConfig
- Defined in:
- lib/puppet/pops/lookup/location_resolver.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Helper methods to resolve interpolated locations
Constant Summary
Constants included from SubLookup
Instance Method Summary collapse
- #expand_globs(datadir, declared_globs, lookup_invocation) ⇒ Object private
-
#expand_uris(declared_uris, lookup_invocation) ⇒ Array<ResolvedLocation>
private
Array of resolved paths.
-
#resolve_paths(datadir, declared_paths, lookup_invocation, is_default_config, extension = nil) ⇒ Array<ResolvedLocation>
private
Array of resolved paths.
Methods included from Interpolation
Methods included from SubLookup
Instance Method Details
#expand_globs(datadir, declared_globs, lookup_invocation) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 40 41 |
# File 'lib/puppet/pops/lookup/location_resolver.rb', line 36 def (datadir, declared_globs, lookup_invocation) declared_globs.map do |declared_glob| glob = datadir + interpolate(declared_glob, lookup_invocation, false) Pathname.glob(glob).reject { |path| path.directory? }.map { |path| ResolvedLocation.new(glob.to_s, path, true) } end.flatten end |
#expand_uris(declared_uris, lookup_invocation) ⇒ Array<ResolvedLocation>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Array of resolved paths.
64 65 66 67 68 69 |
# File 'lib/puppet/pops/lookup/location_resolver.rb', line 64 def (declared_uris, lookup_invocation) declared_uris.map do |declared_uri| uri = URI(interpolate(declared_uri, lookup_invocation, false)) ResolvedLocation.new(declared_uri, uri, true) end end |
#resolve_paths(datadir, declared_paths, lookup_invocation, is_default_config, extension = nil) ⇒ Array<ResolvedLocation>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Array of resolved paths.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/puppet/pops/lookup/location_resolver.rb', line 49 def resolve_paths(datadir, declared_paths, lookup_invocation, is_default_config, extension = nil) result = [] declared_paths.each do |declared_path| path = interpolate(declared_path, lookup_invocation, false) path += extension unless extension.nil? || path.end_with?(extension) path = datadir + path path_exists = path.exist? result << ResolvedLocation.new(declared_path, path, path_exists) unless is_default_config && !path_exists end result end |