Class: Puppet::ModuleTool::Tar::Mini
- Defined in:
- lib/puppet/module_tool/tar/mini.rb
Instance Method Summary collapse
Instance Method Details
#pack(sourcedir, destfile) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/puppet/module_tool/tar/mini.rb', line 22 def pack(sourcedir, destfile) Zlib::GzipWriter.open(destfile) do |writer| Archive::Tar::Minitar.pack(sourcedir, writer) do |step, name, stats| # TODO smcclellan 2017-10-31 Set permissions here when this yield block # executes before the header is written. As it stands, the `stats` # argument isn't mutable in a way that will effect the desired mode for # the file. end end end |
#unpack(sourcefile, destdir, _) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/puppet/module_tool/tar/mini.rb', line 2 def unpack(sourcefile, destdir, _) Zlib::GzipReader.open(sourcefile) do |reader| Archive::Tar::Minitar.unpack(reader, destdir, find_valid_files(reader)) do |action, name, stats| case action when :dir validate_entry(destdir, name) set_dir_mode!(stats) Puppet.debug("Extracting: #{destdir}/#{name}") when :file_start # Octal string of the old file mode. validate_entry(destdir, name) set_file_mode!(stats) Puppet.debug("Extracting: #{destdir}/#{name}") end set_default_user_and_group!(stats) stats end end end |