Class: OsCtld::ContainerControl::Commands::StopByHalt::Frontend

Inherits:
Frontend
  • Object
show all
Includes:
Utils::Wall::Frontend
Defined in:
lib/osctld/container_control/commands/stop_by_halt.rb

Instance Attribute Summary

Attributes inherited from Frontend

#command_class, #ct

Instance Method Summary collapse

Methods included from Utils::Wall::Frontend

#make_message

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) ⇒ true

Parameters:

  • opts (Hash)

    options

Options Hash (**opts):

  • :message (String, nil)

Returns:

  • (true)


14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/osctld/container_control/commands/stop_by_halt.rb', line 14

def execute(**opts)
  unless ct.running?
    raise ContainerControl::Error, 'container not running'
  end

  msg = if opts[:message]
          make_message(opts[:message])
        end

  ret = exec_runner(args: [{ message: msg }])
  ret.ok? || ret
end