Class: OsCtld::ContainerControl::Commands::GetHostname::Runner

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

Instance Attribute Summary

Attributes inherited from Runner

#ctid, #log_file, #lxc_home, #pool, #stderr, #stdin, #stdout, #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(init_pid) ⇒ Object



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

def execute(init_pid)
  sys = OsCtl::Lib::Sys.new
  sys.setns_path(
    File.join('/proc', init_pid.to_s, 'ns/uts'),
    OsCtl::Lib::Sys::CLONE_NEWUTS
  )
  ok(Socket.gethostname)
end