Sha256: 8ccdc81f54d15f3a1768ea1048ce9bf586aa2ca8a64522dada04bb50a7350172

Contents?: true

Size: 1.51 KB

Versions: 68

Compression:

Stored size: 1.51 KB

Contents

# This file is loaded by the autoloader, and it does not find the data function support unless required relative
#
require 'yaml'

module Puppet::DataProviders
  # TODO: API 5.0, remove this class
  # @api private
  # @deprecated
  class YamlDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory
    def create(name, paths, parent_data_provider)
      unless Puppet[:strict] == :off
        Puppet.warn_once(:deprecation, 'Puppet::DataProviders::YamlDataProviderFactory',
        'Puppet::DataProviders::YamlDataProviderFactory is deprecated and will be removed in the next major version of Puppet')
      end
      YamlDataProvider.new(name, paths, parent_data_provider)
    end

    def path_extension
      '.yaml'
    end
  end

  # TODO: API 5.0, remove this class
  # @api private
  # @deprecated
  class YamlDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider
    def initialize_data(path, lookup_invocation)
      unless Puppet[:strict] == :off
        Puppet.warn_once(:deprecation, 'Puppet::DataProviders::YamlDataProvider',
        'Puppet::DataProviders::YamlDataProvider is deprecated and will be removed in the next major version of Puppet')
      end
      data = YAML.load_file(path)
      HieraConfig.symkeys_to_string(data.nil? ? {} : data)
    rescue YAML::SyntaxError => ex
      # Psych errors includes the absolute path to the file, so no need to add that
      # to the message
      raise Puppet::DataBinding::LookupError, "Unable to parse #{ex.message}"
    end
  end
end

Version data entries

68 entries across 68 versions & 2 rubygems

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