Project

General

Profile

Feature #882

add api call to reports page to get the index section

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
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.

Associated revisions

Revision 778b5a0a (diff)
Added by Ohad Levy over 9 years ago

Fixes wrong summary status sting the the report API response refs #882

History

#1 Updated by Ohad Levy over 9 years ago

  • Assignee set to Corey Osman

#2 Updated by Corey Osman over 9 years ago

  • Target version set to 0.3

#3 Updated by Corey Osman over 9 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

#4 Updated by Ohad Levy over 9 years ago

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

Also available in: Atom PDF