Class: OsCtld::ContainerControl::Commands::Stop::Runner

Inherits:
Runner
  • Object
show all
Defined in:
lib/osctld/container_control/commands/stop.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

#do_kill(opts) ⇒ Object (protected)



63
64
65
66
67
68
# File 'lib/osctld/container_control/commands/stop.rb', line 63

def do_kill(opts)
  lxc_ct.stop
  ok
rescue LXC::Error
  error('unable to kill container')
end

#do_shutdown(opts) ⇒ Object (protected)



56
57
58
59
60
61
# File 'lib/osctld/container_control/commands/stop.rb', line 56

def do_shutdown(opts)
  lxc_ct.shutdown(opts[:timeout])
  ok
rescue LXC::Error
  error('unable to shutdown container')
end

#do_stop(opts) ⇒ Object (protected)



48
49
50
51
52
53
54
# File 'lib/osctld/container_control/commands/stop.rb', line 48

def do_stop(opts)
  if do_shutdown(opts)[:status]
    ok
  else
    error('kill required')
  end
end

#execute(mode, opts) ⇒ Object



43
44
45
# File 'lib/osctld/container_control/commands/stop.rb', line 43

def execute(mode, opts)
  send(:"do_#{mode}", opts)
end