Class: OsCtld::ContainerControl::Commands::RunBlock::Runner

Inherits:
Runner
  • Object
show all
Defined in:
lib/osctld/container_control/commands/runblock.rb

Instance Attribute Summary

Attributes inherited from Runner

#ctid, #log_file, #lxc_home, #user_home

Instance Method Summary collapse

Methods inherited from Runner

#error, #initialize, #lxc_ct, #ok, #setup_exec_env, #setup_exec_run_env, #system_path

Constructor Details

This class inherits a constructor from OsCtld::ContainerControl::Runner

Instance Method Details

#execute(opts) ⇒ Integer

Returns exit status.

Parameters:

  • opts (Hash)
  • [Proc] (Hash)

    a customizable set of options

Returns:

  • (Integer)

    exit status



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/osctld/container_control/commands/runblock.rb', line 27

def execute(opts)
  pid = lxc_ct.attach do
    setup_exec_env
    ENV['HOME'] = '/root'
    ENV['USER'] = 'root'
    opts[:block].call
  end

  _, status = Process.wait2(pid)
  ok(status.exitstatus)
end