module HammerCLIForemanTasks::Helper
Public Instance Methods
load_task(id)
click to toggle source
# File lib/hammer_cli_foreman_tasks/helper.rb, line 16 def load_task(id) HammerCLIForeman.foreman_resource!(:foreman_tasks).call(:show, :id => id) end
task_progress(task_or_id)
click to toggle source
render the progress of the task using polling to the task API
# File lib/hammer_cli_foreman_tasks/helper.rb, line 4 def task_progress(task_or_id) task_id = task_or_id.is_a?(Hash) ? task_or_id['id'] : task_or_id if !task_id.empty? options = { verbosity: @context[:verbosity] || HammerCLI::V_VERBOSE, adapter: (@context[:adapter] || :base).to_s } task_progress = TaskProgress.new(task_id, options) { |id| load_task(id) } task_progress.render task_progress.success? else signal_usage_error(_('Please mention appropriate attribute value')) end end