Class: OsCtld::Commands::Container::Wall

Inherits:
Base
  • Object
show all
Includes:
OsCtl::Lib::Utils::Log
Defined in:
lib/osctld/commands/container/wall.rb

Instance Attribute Summary

Attributes inherited from Base

#client, #client_handler, #id, #opts

Instance Method Summary collapse

Methods inherited from Base

#base_execute, #call_cmd, #call_cmd!, #error, #error!, handle, #handled, #indirect?, #initialize, #manipulate, #manipulation_holder, #ok, #progress, #request_stop, run, run!

Constructor Details

This class inherits a constructor from OsCtld::Commands::Base

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/osctld/commands/container/wall.rb', line 9

def execute
  plan = ExecutionPlan.new

  DB::Containers.each_by_ids(opts[:ids], opts[:pool]) do |ct|
    plan << ct
  end

  plan.run do |ct|
    next unless ct.running?

    begin
      ContainerControl::Commands::Wall.run!(
        ct,
        message: opts[:message],
        banner: opts[:banner]
      )
    rescue ContainerControl::Error => e
      log(:info, 'ct-wall', "Error from ct #{ct.ident}: #{e.message}")
    end
  end

  plan.wait
  ok
end