Sha256: 2235bae6ff9f0521fc09dab6908d80d13eac87f872167f7e4e90f35697795166

Contents?: true

Size: 717 Bytes

Versions: 5

Compression:

Stored size: 717 Bytes

Contents

class Job < CloudstackCli::Base

  desc 'job list', 'list async jobs'
  def list
    jobs = client.list_jobs()
    if jobs.size < 1
      say "No jobs found."
    else
      table = [["Command", "Created", "Status", "ID", "User ID"]]
      jobs.each do |job|
        table << [job['cmd'].split('.')[-1], job['created'], job['jobstatus'], job['jobid'], job['userid']]
      end
      print_table table
    end
  end

  desc 'job query ID', 'query async job'
  def query(id)
    job = client.query_job(id)
    job.each do |key, value| 
      say "#{key} : "
      if value.is_a?(Hash)
        value.each {|subkey, subvalue| say "   #{subkey} : #{subvalue}"}
      else 
        say(value)
      end
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cloudstack-cli-0.4.3 lib/cloudstack-cli/commands/job.rb
cloudstack-cli-0.4.2 lib/cloudstack-cli/commands/job.rb
cloudstack-cli-0.4.1 lib/cloudstack-cli/commands/job.rb
cloudstack-cli-0.4.0 lib/cloudstack-cli/commands/job.rb
cloudstack-cli-0.3.11 lib/cloudstack-cli/commands/job.rb