Class: Puppet::Plugins::DataProviders::FileBasedDataProviderFactory Abstract Deprecated Private

Inherits:
PathBasedDataProviderFactory show all
Defined in:
lib/puppet/plugins/data_providers/data_provider.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Deprecated.
This class is abstract.

TODO: API 5.0 Remove this class Factory for creating file based data providers. This is an extension of the path based factory where it is required that each resolved path appoints an existing file in the local file system.

Since:

  • Puppet 4.0.0

Instance Method Summary collapse

Methods inherited from PathBasedDataProviderFactory

#create, #version

Constructor Details

#initializeFileBasedDataProviderFactory

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.

Deprecated.

Returns a new instance of FileBasedDataProviderFactory.

Since:

  • Puppet 4.0.0



374
375
376
377
378
379
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 374

def initialize
  unless Puppet[:strict] == :off
    Puppet.warn_once(:deprecation, 'FileBasedDataProviderFactory',
      'FileBasedDataProviderFactory is deprecated and will be removed in the next major version of Puppet')
  end
end

Instance Method Details

#resolve_paths(datadir, declared_paths, paths, lookup_invocation) ⇒ Array<Puppet::DataProviders::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.

Deprecated.

Returns Array of resolved paths.

Parameters:

  • datadir (Pathname)

    The base when creating absolute paths

  • declared_paths (Array<String>)

    paths as found in declaration. May contain interpolation expressions

  • paths (Array<String>)

    paths that have been preprocessed (interpolations resolved)

  • lookup_invocation (Puppet::Pops::Lookup::Invocation)

    The current lookup invocation

Returns:

  • (Array<Puppet::DataProviders::ResolvedLocation>)

    Array of resolved paths

Since:

  • Puppet 4.0.0



387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 387

def resolve_paths(datadir, declared_paths, paths, lookup_invocation)
  resolved_paths = []
  unless paths.nil? || datadir.nil?
    ext = path_extension
    paths.each_with_index do |path, idx|
      path = path + ext unless path.end_with?(ext)
      path = datadir + path
      resolved_paths << Puppet::Pops::Lookup::ResolvedLocation.new(declared_paths[idx], path, path.exist?)
    end
  end
  resolved_paths
end