Class: OsCtld::ContainerControl::Commands::Stop::Frontend
- Includes:
- Utils::Wall::Frontend
- Defined in:
- lib/osctld/container_control/commands/stop.rb
Instance Attribute Summary
Attributes inherited from Frontend
Instance Method Summary collapse
Methods included from Utils::Wall::Frontend
Methods inherited from Frontend
#exec_runner, #fork_runner, #initialize
Constructor Details
This class inherits a constructor from OsCtld::ContainerControl::Frontend
Instance Method Details
#execute(mode, **opts) ⇒ true
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/osctld/container_control/commands/stop.rb', line 24 def execute(mode, **opts) unless %i[stop shutdown kill].include?(mode) raise ArgumentError, "invalid stop mode '#{mode}'" end CGroup.thaw_tree(ct.cgroup_path) if mode == :kill if opts[:message] && ct.running? opts = opts.merge(message: (opts[:message])) else opts.delete(:message) end ret = if %i[stop shutdown].include?(mode) && ct.running? exec_runner(args: [mode, opts.merge(halt_from_inside: true)]) else fork_runner(args: [mode, opts]) end if ret.ok? true elsif mode == :stop CGroup.thaw_tree(ct.cgroup_path) ret = fork_runner(args: [:kill, opts]) ret.ok? || ret else ret end end |