Class: Chef::Knife::JobOutput

Inherits:
Chef::Knife show all
Defined in:
lib/chef/knife/job_output.rb

Instance Method Summary collapse

Instance Method Details

#get_channel(channel) ⇒ Object



40
41
42
43
44
45
# File 'lib/chef/knife/job_output.rb', line 40

def get_channel(channel)
  channel ||= "stdout"
  return channel if channel == "stdout" || channel == "stderr"

  raise "Invalid Format please enter stdout or stderr"
end

#runObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/chef/knife/job_output.rb', line 28

def run
  job_id = name_args[0]
  channel = get_channel(config[:channel])
  node = name_args[1]

  uri = "pushy/jobs/#{job_id}/output/#{node}/#{channel}"

  job = rest.get_rest(uri, { "Accept" => "application/octet-stream" })

  output(job)
end