Class: OsCtl::Lib::Exporter::Tar
- Includes:
- Utils::Log, Utils::System
- Defined in:
- lib/libosctl/exporter/tar.rb
Overview
Handles dumping containers into tar archives
The container’s rootfs is stored as a compressed tar archive.
Constant Summary
Constants inherited from Base
Base::BLOCK_SIZE, Base::DIR_MODE, Base::FILE_MODE
Instance Attribute Summary
Attributes inherited from Base
#base_snap, #ct, #datasets, #opts, #tar
Instance Method Summary collapse
Methods included from Utils::System
#repeat_on_failure, #syscmd, #zfs
Methods included from Utils::Log
Methods inherited from Base
#add_file_from_disk, #close, #dump_configs, #dump_metadata, #dump_user_hook_scripts, #initialize
Constructor Details
This class inherits a constructor from OsCtl::Lib::Exporter::Base
Instance Method Details
#format ⇒ Object
22 23 24 |
# File 'lib/libosctl/exporter/tar.rb', line 22 def format :tar end |
#pack_rootfs ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/libosctl/exporter/tar.rb', line 11 def pack_rootfs tar.mkdir('rootfs', DIR_MODE) tar.add_file('rootfs/base.tar.gz', FILE_MODE) do |tf| IO.popen("exec tar --xattrs-include=security.capability --xattrs -cz -C #{ct.rootfs} .") do |io| tf.write(io.read(BLOCK_SIZE)) until io.eof? end raise "tar failed with exit status #{$?.exitstatus}" if $?.exitstatus != 0 end end |