Sha256: 41b2b779754276d628a8516b6104169e7142b423ce53122983a72cd05b2f3295

Contents?: true

Size: 1.19 KB

Versions: 96

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 reference 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

96 entries across 96 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.12 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.12-x86-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.12-x64-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.12-universal-darwin lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.11 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.11-x86-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.11-x64-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.11-universal-darwin lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.10 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.10-x86-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.10-x64-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.10-universal-darwin lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.9 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.9-x86-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.9-x64-mingw32 lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb
puppet-4.10.9-universal-darwin lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb