Module: HammerCLIForemanTasks::Async

Included in:
AsyncCommand
Defined in:
lib/hammer_cli_foreman_tasks/async_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
# File 'lib/hammer_cli_foreman_tasks/async_command.rb', line 5

def self.included(base)
  base.send(:include, HammerCLIForemanTasks::Helper)
  base.send(:option, '--async', :flag, 'Do not wait for the task')
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
# File 'lib/hammer_cli_foreman_tasks/async_command.rb', line 10

def execute
  if option_async?
    super
  else
    success = task_progress(send_request)
    success ? HammerCLI::EX_OK : HammerCLI::EX_SOFTWARE
  end
end