sos.reporting — Reporting Interface

This provides a restricted tag language to define the sosreport index/report

class sos.reporting.Alert(content)[source]

Bases: sos.reporting.Leaf

Alert.ADDS_TO = 'alerts'
class sos.reporting.Command(name, return_code, href)[source]

Bases: sos.reporting.Leaf

Command.ADDS_TO = 'commands'
class sos.reporting.CopiedFile(name, href)[source]

Bases: sos.reporting.Leaf

CopiedFile.ADDS_TO = 'copied_files'
class sos.reporting.CreatedFile(name, href)[source]

Bases: sos.reporting.Leaf

CreatedFile.ADDS_TO = 'created_files'
class sos.reporting.HTMLReport(report_node)[source]

Bases: sos.reporting.PlainTextReport

Will generate a HTML report from a top_level Report object

HTMLReport.ALERT = '<li>%s</li>'
HTMLReport.FOOTER = '</body></html>'
HTMLReport.HEADER = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n <head>\n <meta http-equiv="Content-Type" content="text/html;\n charset=utf-8" />\n <title>Sos System Report</title>\n <style type="text/css">\n td {\n padding: 0 5px;\n }\n </style>\n </head>\n <body>\n'
HTMLReport.LEAF = '<li><a href="%(href)s">%(name)s</a></li>'
HTMLReport.NOTE = '<li>%s</li>'
HTMLReport.PLUGDIVIDER = '<hr/>\n'
HTMLReport.PLUGINFORMAT = '<h2 id="{name}">Plugin <em>{name}</em></h2>'
HTMLReport.PLUGLISTFOOTER = '</tr></table>'
HTMLReport.PLUGLISTHEADER = '<h3>Loaded Plugins:</h3><table><tr>'
HTMLReport.PLUGLISTITEM = '<td><a href="#{name}">{name}</a></td>\n'
HTMLReport.PLUGLISTMAXITEMS = 5
HTMLReport.PLUGLISTSEP = '</tr>\n<tr>'
HTMLReport.subsections = ((<class 'sos.reporting.Command'>, '<li><a href="%(href)s">%(name)s</a></li>', '<p>Commands executed:</p><ul>', '</ul>'), (<class 'sos.reporting.CopiedFile'>, '<li><a href="%(href)s">%(name)s</a></li>', '<p>Files copied:</p><ul>', '</ul>'), (<class 'sos.reporting.CreatedFile'>, '<li><a href="%(href)s">%(name)s</a></li>', '<p>Files created:</p><ul>', '</ul>'), (<class 'sos.reporting.Alert'>, '<li>%s</li>', '<p>Alerts:</p><ul>', '</ul>'), (<class 'sos.reporting.Note'>, '<li>%s</li>', '<p>Notes:</p><ul>', '</ul>'))
class sos.reporting.JSONReport(report_node)[source]

Bases: sos.reporting.PlainTextReport

Will generate a JSON report from a top_level Report object

JSONReport.unicode()[source]
class sos.reporting.Leaf[source]

Bases: sos.reporting.Node

Marker class that can be added to a Section node

class sos.reporting.Node[source]

Bases: object

Node.can_add(node)[source]
class sos.reporting.Note(content)[source]

Bases: sos.reporting.Leaf

Note.ADDS_TO = 'notes'
class sos.reporting.PlainTextReport(report_node)[source]

Bases: object

Will generate a plain text report from a top_level Report object

PlainTextReport.ALERT = ' ! %s'
PlainTextReport.FOOTER = ''
PlainTextReport.HEADER = ''
PlainTextReport.LEAF = ' * %(name)s'
PlainTextReport.NOTE = ' * %s'
PlainTextReport.PLUGDIVIDER = '========================================================================'
PlainTextReport.PLUGINFORMAT = '{name}'
PlainTextReport.PLUGLISTFOOTER = ''
PlainTextReport.PLUGLISTHEADER = 'Loaded Plugins:'
PlainTextReport.PLUGLISTITEM = ' {name}'
PlainTextReport.PLUGLISTMAXITEMS = 5
PlainTextReport.PLUGLISTSEP = '\n'
PlainTextReport.line_buf = []
PlainTextReport.process_subsection(section, key, header, format_, footer)[source]
PlainTextReport.subsections = ((<class 'sos.reporting.Command'>, ' * %(name)s', '- commands executed:', ''), (<class 'sos.reporting.CopiedFile'>, ' * %(name)s', '- files copied:', ''), (<class 'sos.reporting.CreatedFile'>, ' * %(name)s', '- files created:', ''), (<class 'sos.reporting.Alert'>, ' ! %s', '- alerts:', ''), (<class 'sos.reporting.Note'>, ' * %s', '- notes:', ''))
PlainTextReport.unicode()[source]
class sos.reporting.Report[source]

Bases: sos.reporting.Node

The root element of a report. This is a container for sections.

Report.add(*nodes)[source]
Report.can_add(node)[source]
class sos.reporting.Section(name)[source]

Bases: sos.reporting.Node

A section is a container for leaf elements. Sections may be nested inside of Report objects only.

Section.add(*nodes)[source]
Section.can_add(node)[source]
sos.reporting.ends_bs(string)[source]

Return True if ‘string’ ends with a backslash, and False otherwise.

Define this as a named function for no other reason than that pep8 now forbids binding of a lambda expression to a name:

‘E731 do not assign a lambda expression, use a def’

Previous topic

sos.policies — Policy Interface

Next topic

sos.utilities — Utilites Interface

This Page