Project

General

Profile

Actions

Feature #882

closed

add api call to reports page to get the index section

Added by Corey Osman over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Need api call to get back a list of reports via json so that it returns the same thing http://foreman/reports currently does.

Will need report summary, timestamp, hosts, report id, report status.

Actions #1

Updated by Ohad Levy over 13 years ago

  • Assignee set to Corey Osman
Actions #2

Updated by Corey Osman over 13 years ago

  • Target version set to 0.3
Actions #3

Updated by Corey Osman over 13 years ago

This does not work correctly. The code below (in the patch) only returns success and never returns a summary status with failed or modified.
You can reproduce this by using the following url

1. http://puppet/reports?search=failed%3E0&format=json
2. Use the browser search to find the summary. The summary result should be "failed" instead of "success"

def summarystatus
    case self
    when error?
      "Failed" 
    when changes?
      "Modified" 
    else
      "Success" 
    end
  end

The following code ensures the correct status will be returned.

 def summarystatus
    if self.error?
       return "Failed" 
    elsif self.changes?
       return "Modified" 
    else
       return "Success" 
    end
  end

Actions #4

Updated by Ohad Levy over 13 years ago

  • Category set to API
  • Status changed from New to Closed
Actions

Also available in: Atom PDF