Class: OsCtld::ContainerControl::Commands::WithMountns::Frontend

Inherits:
Frontend
  • Object
show all
Defined in:
lib/osctld/container_control/commands/with_mountns.rb

Instance Attribute Summary

Attributes inherited from Frontend

#command_class, #ct

Instance Method Summary collapse

Methods inherited from Frontend

#exec_runner, #fork_runner, #initialize

Constructor Details

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

Instance Method Details

#execute(opts) ⇒ Object

Parameters:

  • opts (Hash)

Options Hash (opts):

  • :ctrc (Container::RunConfiguration, nil)
  • :ns_pid (Integer)
  • :chroot (String, nil)
  • :switch_to_system (Boolean)
  • :stdout (IO, nil)
  • :block (Proc)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/osctld/container_control/commands/with_mountns.rb', line 19

def execute(opts)
  ct.mount

  ret = fork_runner({
    args: [{
      ctrc: opts.fetch(:ctrc, ct.get_run_conf),
      ns_pid: opts[:ns_pid],
      chroot: opts[:chroot],
      switch_to_system: opts.fetch(:switch_to_system, true),
      block: opts[:block]
    }],
    switch_to_system: false,
    stdout: opts[:stdout]
  }.compact)
  ret.ok? ? ret.data : ret
end