Sha256: 2f3c21350b36dbcc89bad943b1f189fc6f94436b5c8a9066378ee2d6268ad943

Contents?: true

Size: 1.19 KB

Versions: 150

Compression:

Stored size: 1.19 KB

Contents

require 'puppet/pops/binder/scheme_handler/symbolic_scheme'

# Similar to {Puppet::Pops::Binder::SchemeHandler::ModuleScheme ModuleScheme}, but relative to the config root.
# Does not support wildcard expansion.
#
# URI
# ---
# The URI scheme is `confdir:/[<FQN>]['?' | [?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`.
#
# @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.
#
class Puppet::Pops::Binder::SchemeHandler::ConfdirScheme < Puppet::Pops::Binder::SchemeHandler::SymbolicScheme

  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

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

Version data entries

150 entries across 150 versions & 2 rubygems

Version Path
puppet-retrospec-1.5.0 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.4.1 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.4.0 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.3.2 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.3.1 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.3.0 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.2.1 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.2.0 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.1.0 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.3 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.3-x86-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.3-x64-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.3-universal-darwin lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.0.0 vendor/gems/puppet-4.5.2/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.2 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.2-x86-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.2-x64-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.2-universal-darwin lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.1 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.5.1-x86-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb