Class: Puppet::Pops::Binder::SchemeHandler::ConfdirScheme

Inherits:
SymbolicScheme show all
Defined in:
lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb

Overview

TODO:

If the file to load is outside of the file system rooted at $confdir (in a gem, or just on the Ruby path), it can not be marked as optional as it will always be ignored.

Similar to ModuleScheme, but relative to the config root. Does not support wildcard expansion.

URI


The URI scheme is ‘confdir:/[’?‘ | [?optional]` where FQN is the fully qualified name of the bindings to load. The referecence is made optional by using a URI query of `?` or `?optional`.

Instance Method Summary collapse

Methods inherited from SymbolicScheme

#contributed_bindings, #fqn_from_path, #has_wildcard?, #is_optional?

Methods inherited from Puppet::Plugins::BindingSchemes::BindingsSchemeHandler

#contributed_bindings, #is_optional?

Instance Method Details

#expand_excluded(uri, composer) ⇒ Object



31
32
33
# File 'lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb', line 31

def expand_excluded(uri, composer)
  [URI.parse("confdir:/#{fqn_from_path(uri)[1]}")]
end

#expand_included(uri, composer) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb', line 17

def expand_included(uri, composer)
  fqn = fqn_from_path(uri)[1]
  if is_optional?(uri)
    if Puppet::Pops::Binder::BindingsLoader.loadable?(composer.confdir, fqn)
      [URI.parse('confdir:/' + fqn)]
    else
      []
    end
  else
    # assume it exists (do not give error if not, since it may be excluded later)
    [URI.parse('confdir:/' + fqn)]
  end
end