backend/satellite_tools/reports.py | 22 ++++++++- backend/satellite_tools/reports/data/entitlements | 20 ++++++-- backend/satellite_tools/reports/data/errata-list | 18 ++++++-- backend/satellite_tools/reports/data/errata-systems | 18 +++++--- backend/satellite_tools/reports/data/inventory | 45 ++++++++++++-------- backend/satellite_tools/spacewalk-report | 43 +++++++++++++++++-- 6 files changed, 128 insertions(+), 38 deletions(-)
New commits: commit 1c5677d80cbb806118dd96cb2be2e53b7f02c46c Author: Jan Pazdziora jpazdziora@redhat.com Date: Fri Oct 23 17:10:53 2009 +0200
reporting: add --info to --list-fields, showing descriptions with field (column) list.
diff --git a/backend/satellite_tools/spacewalk-report b/backend/satellite_tools/spacewalk-report index edbf571..0143698 100755 --- a/backend/satellite_tools/spacewalk-report +++ b/backend/satellite_tools/spacewalk-report @@ -79,6 +79,8 @@ def processCommandlineReport(report): Option('--list-fields', action='store_true', dest='listfields', help='list fields of the report instead of running the report'), + Option('--info', action='store_true', + help='print description for each column'), ] optionParserReport = OptionParser( usage="options for report %s" % report, @@ -114,8 +116,18 @@ if __name__ == '__main__': need_exit = True
if report_options.listfields: + if options.info: + print + print "Fields in the report:" + print + for c in report.columns: - print c + text = c + if options.info: + text = " %s" % c + if report_options.info and report.column_descriptions.has_key(c) : + text = "%s: %s" % ( text, report.column_descriptions[c] ) + print text need_exit = True
if need_exit:
commit feff62a4c7b6945169d1b5bac612f68dd56b5969 Author: Jan Pazdziora jpazdziora@redhat.com Date: Fri Oct 23 17:10:22 2009 +0200
reporting: add processing of column descriptions.
diff --git a/backend/satellite_tools/reports.py b/backend/satellite_tools/reports.py index 877628c..868ec39 100644 --- a/backend/satellite_tools/reports.py +++ b/backend/satellite_tools/reports.py @@ -72,12 +72,21 @@ class report:
def _set(self, tag, value): if tag == 'columns': - self.columns = filter(lambda x: x != '', re.split('\s+', value)) - # set mapping from column name to column position in column_indexes + self.columns = [] self.column_indexes = {} + self.column_descriptions = {} + lines = filter(lambda x: x != '', re.split('\s*\n\s*', value)) i = 0 - for c in self.columns: + for l in lines: + description = None + try: + ( c, description ) = re.split('\s+', l, 1) + except: + c = l + self.columns.append(c) self.column_indexes[c] = i + if description != None: + self.column_descriptions[c] = description i = i + 1 elif tag == 'multival_columns': # the multival_columns specifies either
commit cca328f6b7f67436569a56be9c49274d933cae6c Author: Jan Pazdziora jpazdziora@redhat.com Date: Fri Oct 23 17:09:39 2009 +0200
reporting: with --info and no report name, show synopsis in report list.
diff --git a/backend/satellite_tools/spacewalk-report b/backend/satellite_tools/spacewalk-report index a8fe0cd..edbf571 100755 --- a/backend/satellite_tools/spacewalk-report +++ b/backend/satellite_tools/spacewalk-report @@ -172,8 +172,17 @@ if __name__ == '__main__': if outrow != None: writer.writerow(outrow) else: - for r in reports.available_reports(): - print r + for report_name in reports.available_reports(): + if options.info: + synopsis = '' + try: + report = reports.report(report_name) + synopsis = report.synopsis + except: + None + print "%s: %s" % ( report_name, synopsis ) + else: + print report_name
except KeyboardInterrupt: systemExit(-1, "\nUser interrupted process.")
commit b1adcc01cb675d93055fbaf02188a7f761da1d19 Author: Jan Pazdziora jpazdziora@redhat.com Date: Fri Oct 23 16:44:49 2009 +0200
reporting: add option --info and print synopsis and description.
diff --git a/backend/satellite_tools/spacewalk-report b/backend/satellite_tools/spacewalk-report index af81457..a8fe0cd 100755 --- a/backend/satellite_tools/spacewalk-report +++ b/backend/satellite_tools/spacewalk-report @@ -58,6 +58,8 @@ def processCommandline(): Option('--db', action='store', type="string", help='alternative database string (username/password@sid);' \ + ' default is default_db from /etc/rhn/rhn.conf'), + Option('--info', action='store_true', + help='print synopsis of the report in the list of report, or description of individual reports specified'), ]
optionParser = OptionParser( \ @@ -100,9 +102,23 @@ if __name__ == '__main__': except(reports.spacewalk_unknown_report): systemExit(-4, 'Unknown report [%s].' % report_name)
+ need_exit = None + if options.info: + if report.synopsis != None: + print report.synopsis + else: + print "No synopsis for report %s." % report_name + if report.description != None: + print + print report.description + need_exit = True + if report_options.listfields: for c in report.columns: print c + need_exit = True + + if need_exit: sys.exit(0)
initCFG('server')
commit 4fe38682d43366fd64f054c65f842bc862482547 Author: Jan Pazdziora jpazdziora@redhat.com Date: Fri Oct 23 16:44:27 2009 +0200
reporting: add processing of the synopsis and description tags.
diff --git a/backend/satellite_tools/reports.py b/backend/satellite_tools/reports.py index d947244..877628c 100644 --- a/backend/satellite_tools/reports.py +++ b/backend/satellite_tools/reports.py @@ -11,8 +11,11 @@ class report: def __init__(self, name): full_path = os.path.join(REPORT_DEFINITIONS, name) self.sql = None + self.description = None + self.synopsis = None self.columns = None self.column_indexes = None + self.column_descriptions = None self.multival_column_names = {} self.multival_columns_reverted = {} self.multival_columns_stop = [] @@ -93,6 +96,10 @@ class report: self.multival_column_names[col] = id_col elif tag == 'sql': self.sql = value + elif tag == 'synopsis': + self.synopsis = re.sub('^(\s*\n)+\s*|(\s*\n)+$', '', value) + elif tag == 'description': + self.description = re.sub('(?m)^\s*', ' ', re.sub('^(\s*\n)+\s*|(\s*\n)+$', '', value)) else: raise spacewalk_report_unknown_tag_exception(tag)
commit 82915d38da373db662f04ab3b13958e7f6584c90 Author: Jan Pazdziora jpazdziora@redhat.com Date: Fri Oct 23 16:36:10 2009 +0200
reporting: added synopsis, description, and column descriptions to all four reports.
diff --git a/backend/satellite_tools/reports/data/entitlements b/backend/satellite_tools/reports/data/entitlements index 23ba37b..c9eb2f8 100755 --- a/backend/satellite_tools/reports/data/entitlements +++ b/backend/satellite_tools/reports/data/entitlements @@ -1,11 +1,21 @@
+synopsis: + + Entitlement and channel list and usage + +description: + + For each organization, list of system entitlements and + channels to which the organization is entitled, together + with current usage. + columns:
- organization_id - organization - entitlement_type - entitlement - used + organization_id Organization identifier + organization Organization name + entitlement_type 'system' or 'channel' + entitlement System entitlement name or channel name + used How many entitlements are currently used
multival_columns:
diff --git a/backend/satellite_tools/reports/data/errata-list b/backend/satellite_tools/reports/data/errata-list index f76a918..57a5fd1 100755 --- a/backend/satellite_tools/reports/data/errata-list +++ b/backend/satellite_tools/reports/data/errata-list @@ -1,10 +1,20 @@
+synopsis: + + Errata out of compliance information - errata details + +description: + + List of erratas that are applicable to at least one registered + system, together with basic info about the errata. Also see + errata-systems report to get list of systems that are affected. + columns:
- advisory - cve - synopsis - systems_affected + advisory Advisory / errata identifier + cve List of CVE names (Common Vulnerabilities and Exposures Identifiers) addressed by the errata + synopsis Synopsis of the errata + systems_affected Number of systems to which this errata is applicable
multival_columns:
diff --git a/backend/satellite_tools/reports/data/errata-systems b/backend/satellite_tools/reports/data/errata-systems index 85079d3..f40aa9f 100755 --- a/backend/satellite_tools/reports/data/errata-systems +++ b/backend/satellite_tools/reports/data/errata-systems @@ -1,11 +1,19 @@
+synopsis: + + Errata out of compliance information - erratas for systems + +description: + + List of applicable erratas and systems that are affected. + columns:
- advisory - server_id - profile_name - hostname - ip_address + advisory Advisory / errata identifier + server_id System identifier + profile_name Profile name, as stored on server + hostname Hostname, as reported by the system + ip_address IP address, as reported by the system
sql:
diff --git a/backend/satellite_tools/reports/data/inventory b/backend/satellite_tools/reports/data/inventory index 60af329..7662898 100755 --- a/backend/satellite_tools/reports/data/inventory +++ b/backend/satellite_tools/reports/data/inventory @@ -1,24 +1,33 @@
+synopsis: + + Inventory report + +description: + + List of systems registered to the server, together with + hardware and software information. + columns:
- server_id - profile_name - hostname - ip_address - registered_by - registration_time - last_checkin_time - kernel_version - packages_out_of_date - errata_out_of_date - software_channel - configuration_channel - entitlements - system_group - organization - virtual_host - architecture - hardware + server_id System identifier + profile_name Profile name, as stored on server + hostname Hostname, as reported by the system + ip_address IP address, as reported by the system + registered_by User under which the system is registered + registration_time Registration time + last_checkin_time Last checkin time + kernel_version Kernel version, as reported by the system + packages_out_of_date Number of packages that can be upgraded + errata_out_of_date Number of erratas that can be applied + software_channel List of channels to which the system is registered + configuration_channel List of configuration channels + entitlements List of entitlements + system_group List of system group to which the system belongs + organization Organization name + virtual_host System identifier of host, if system is a guest + architecture Architecture of the system + hardware Hardware information
multival_columns:
spacewalk-commits@lists.fedorahosted.org