Class: Chef::Knife::GoiardiRunsShow

Inherits:
Chef::Knife show all
Includes:
Goiardi::Reporting::KnifeHelpers
Defined in:
lib/chef/knife/goiardi_runs_show.rb

Constant Summary collapse

PROTOCOL_VERSION =
'0.1.0'
HEADERS =
{'X-Ops-Reporting-Protocol-Version' => PROTOCOL_VERSION}

Constants included from Goiardi::Reporting::KnifeHelpers

Goiardi::Reporting::KnifeHelpers::SECONDS_IN_24HOURS, Goiardi::Reporting::KnifeHelpers::SECONDS_IN_3MONTHS

Instance Method Summary collapse

Methods included from Goiardi::Reporting::KnifeHelpers

#apply_time_args, #check_3month_window, #check_start_and_end_times_provided, #convert_to_unix_timestamps, #last_24hours_time_window, #uuid?

Instance Method Details

#runObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/chef/knife/goiardi_runs_show.rb', line 39

def run
  rest = Chef::REST.new(Chef::Config[:chef_server_url])

  run_id = name_args[0]

  if run_id.nil?
    show_usage
    exit 1
  elsif uuid?(run_id)
    puts "Run ID should be a Chef Client Run ID, e.g: 11111111-1111-1111-1111-111111111111"
    exit 1
  end

  query_string = "reports/org/runs/#{run_id}"

  runs = rest.get(query_string, false, HEADERS)

  output(runs)
end