Method: Puppet::Forge.get_release_package_from_filesystem

Defined in:
lib/vendor/puppet/forge.rb

.get_release_package_from_filesystem(filename) ⇒ Object

Locate a module release package on the local filesystem and move it into the ‘Puppet.settings`. Do not unpack it, just return the location of the package on disk.



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/vendor/puppet/forge.rb', line 83

def self.get_release_package_from_filesystem(filename)
  if File.exist?(File.expand_path(filename))
    repository = Repository.new('file:///')
    uri = URI.parse("file://#{URI.escape(File.expand_path(filename))}")
    cache_path = repository.retrieve(uri)
  else
    raise ArgumentError, "File does not exists: #{filename}"
  end

  cache_path
end