Sha256: 214de5550006052952f15d03e0f5a60f3e7aa2982254e86d8557142c62e406fb

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

module HammerCLIForemanTasks
  module Helper
    # render the progress of the task using polling to the task API
    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?
        task_progress = TaskProgress.new(task_id) { |id| load_task(id) }
        task_progress.render
        task_progress.success?
      else
        signal_usage_error(_('Please mention appropriate attribute value'))
      end
    end

    def load_task(id)
      HammerCLIForeman.foreman_resource!(:foreman_tasks).call(:show, :id => id)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hammer_cli_foreman_tasks-0.0.13 lib/hammer_cli_foreman_tasks/helper.rb