Class: OsCtl::Lib::Exporter::Tar
- Inherits:
-
Exporter::Base
- Object
- Exporter::Base
- 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.
Instance Method Summary collapse
Methods included from Utils::System
#find_executable!, #read_process_output, #repeat_on_failure, #syscmd, #syscmd_argv, #write_stdin, #zfs
Methods included from Utils::Log
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 |