diff --git a/README.md b/README.md index bae1456d5c6cb7c47b7e09f83fff511b259d90b5..05418a951e556ef2fd7974d92ab3204c910c8b05 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/inv_cisco_support-0.3.1-20240615.mkp "inv_cisco_support-0.3.1-20240615.mkp" +[PACKAGE]: ../../raw/master/mkp/inv_cisco_support-0.3.2-20240616.mkp "inv_cisco_support-0.3.2-20240616.mkp" # Cisco support APIs inventory plugin Adds live cycle information for Cisco devices to the inventory. diff --git a/mkp/inv_cisco_support-0.3.2-20240616.mkp b/mkp/inv_cisco_support-0.3.2-20240616.mkp new file mode 100644 index 0000000000000000000000000000000000000000..3440a7639015d979c73021ef5174276792d6564c Binary files /dev/null and b/mkp/inv_cisco_support-0.3.2-20240616.mkp differ diff --git a/source/packages/inv_cisco_support b/source/packages/inv_cisco_support index e37648cfc4b40ddb63ea082c3664010292be7afe..ffca5701afe72c11b6bffa1b57141a81e1a80eb7 100644 --- a/source/packages/inv_cisco_support +++ b/source/packages/inv_cisco_support @@ -38,7 +38,7 @@ 'name': 'inv_cisco_support', 'title': 'Inventory for Cisco Bug, EoX, contract status, PSIRT advisories and ' 'suggested software', - 'version': '0.3.1-20240615', - 'version.min_required': '2.2.0b1', - 'version.packaged': '2.2.0p24', - 'version.usable_until': '2.3.0b1'} + 'version': '0.3.2-20240616', + 'version.min_required': '2.3.0b1', + 'version.packaged': 'cmk-mkp-tool 0.2.0', + 'version.usable_until': '2.4.0b1'} diff --git a/source/web/plugins/views/inv_cisco_livecycle.py b/source/web/plugins/views/inv_cisco_livecycle.py index 3c47bd0bc5e0c5761b1c52a5cc40702f18dca8a8..16ed923433e88ac0cf5bfe7d65a3bc31f58623ad 100644 --- a/source/web/plugins/views/inv_cisco_livecycle.py +++ b/source/web/plugins/views/inv_cisco_livecycle.py @@ -18,24 +18,16 @@ # removed declare_view # 2023-10-25: fixed loading of painters for CMK 2.2.0 # 2024-06-15: moved view back to ~/local/share/check_mk/web/plugin/views +# 2024-06-16: modified imports for CMK 2.3 import time -from cmk.gui.i18n import _ -from cmk.gui.views.inventory.registry import inventory_displayhints - -from cmk.gui.views.inventory import ( - decorate_inv_paint, - PaintResult, - update_paint_functions, -) -from cmk.gui.plugins.visuals.inventory import ( - FilterInvtableText, -) +from cmk.gui.i18n import _ +from cmk.gui.inventory.filters import FilterInvtableText from cmk.gui.utils.html import HTML +from cmk.gui.views.inventory import PaintResult, decorate_inv_paint +from cmk.gui.views.inventory.registry import inventory_displayhints -# -ENABLE_PAINTERS = True # ################################################################################# # @@ -67,9 +59,6 @@ def inv_paint_date_status(date_string) -> PaintResult: return css_class, '%s' % date_string -update_paint_functions({'inv_paint_date_status': inv_paint_date_status}) - - @decorate_inv_paint() def inv_paint_last_checked_status(date_string) -> PaintResult: warn_days = 32 @@ -89,9 +78,6 @@ def inv_paint_last_checked_status(date_string) -> PaintResult: return css_class, ' %s' % date_string -update_paint_functions({'inv_paint_last_checked_status': inv_paint_last_checked_status}) - - @decorate_inv_paint() def inv_paint_psirt_advisoryid(advisoryId) -> PaintResult: psirt_url = HTML( @@ -100,9 +86,6 @@ def inv_paint_psirt_advisoryid(advisoryId) -> PaintResult: return '', psirt_url -update_paint_functions({'inv_paint_psirt_advisoryid': inv_paint_psirt_advisoryid}) - - @decorate_inv_paint() def inv_paint_eox_eolid(eolid) -> PaintResult: if eolid is not None: @@ -114,9 +97,6 @@ def inv_paint_eox_eolid(eolid) -> PaintResult: return '', search_eolid_url -update_paint_functions({'inv_paint_eox_eolid': inv_paint_eox_eolid}) - - @decorate_inv_paint() def inv_paint_bug_bugid(bugid) -> PaintResult: if bugid is not None: @@ -128,9 +108,6 @@ def inv_paint_bug_bugid(bugid) -> PaintResult: return '', search_bugid_url -update_paint_functions({'inv_paint_bug_bugid': inv_paint_bug_bugid}) - - @decorate_inv_paint() def inv_paint_psirt_bugid(bugids) -> PaintResult: search_bugid_url = '' @@ -145,8 +122,6 @@ def inv_paint_psirt_bugid(bugids) -> PaintResult: return '', search_bugid_url -update_paint_functions({'inv_paint_psirt_bugid': inv_paint_psirt_bugid}) - # # Painter functions END # @@ -168,15 +143,34 @@ inventory_displayhints.update({ ], 'view': 'invciscoeox_of_host', }, - '.hardware.support.cisco_eox:*.pid': {'title': _('PID (EoX)'), }, - '.hardware.support.cisco_eox:*.serial_number': {'title': _('Serial number'), }, - '.hardware.support.cisco_eox:*.ProductIDDescription': {'title': _('Description'), }, + '.hardware.support.cisco_eox:*.EOXExternalAnnouncementDate': { + 'title': _('EOL Announcement'), 'paint': 'date_status'}, + '.hardware.support.cisco_eox:*.EndOfRoutineFailureAnalysisDate': { + 'title': _('End of routine failure analysis'), 'paint': 'date_status'}, + '.hardware.support.cisco_eox:*.EndOfSWMaintenanceReleases': { + 'title': _('End of software maintenace releases'), 'paint': 'date_status' + }, + '.hardware.support.cisco_eox:*.EndOfSaleDate': {'title': _('End of sale'), 'paint': 'date_status'}, + '.hardware.support.cisco_eox:*.EndOfSecurityVulSupportDate': { + 'title': _('End of service vulnerability support'), 'paint': 'date_status' + }, + '.hardware.support.cisco_eox:*.EndOfSvcAttachDate': { + 'title': _('End of service attachment'), 'paint': 'date_status' + }, + '.hardware.support.cisco_eox:*.LastDateOfSupport': {'title': _('End of support'), 'paint': 'date_status'}, + '.hardware.support.cisco_eox:*.Last_checked': {'title': _('Last checked'), 'paint': 'last_checked_status'}, '.hardware.support.cisco_eox:*.LinkToProductBulletinURL': {'title': _('EOL bulletin URL'), }, - '.hardware.support.cisco_eox:*.UpdatedTimeStamp': {'title': _('EOL bulletin last update'), }, - '.hardware.support.cisco_eox:*.MigrationProductId': {'title': _('Migration PID'), }, '.hardware.support.cisco_eox:*.MigrationInformation': {'title': _('Migration information'), }, + '.hardware.support.cisco_eox:*.MigrationProductId': {'title': _('Migration PID'), }, '.hardware.support.cisco_eox:*.MigrationProductInfoURL': {'title': _('Migration PID URL'), }, '.hardware.support.cisco_eox:*.MigrationProductName': {'title': _('Migration product name'), }, + '.hardware.support.cisco_eox:*.ProductBulletinNumber': { + 'title': _('EOL bulletin ID'), 'filter': FilterInvtableText, 'paint': 'eox_eolid' + }, + '.hardware.support.cisco_eox:*.ProductIDDescription': {'title': _('Description'), }, + '.hardware.support.cisco_eox:*.UpdatedTimeStamp': {'title': _('EOL bulletin last update'), }, + '.hardware.support.cisco_eox:*.pid': {'title': _('PID (EoX)'), }, + '.hardware.support.cisco_eox:*.serial_number': {'title': _('Serial number'), }, }) # SN2Info (contract) display hints @@ -189,21 +183,25 @@ inventory_displayhints.update({ ], 'view': 'invciscocontract_of_host', }, - '.hardware.support.cisco_contract:*.pid': {'title': _('PID (contract)'), }, - '.hardware.support.cisco_contract:*.serial_number': {'title': _('Serial number'), }, + '.hardware.support.cisco_contract:*.Last_checked': {'title': _('Last checked'), 'paint': 'last_checked_status'}, '.hardware.support.cisco_contract:*.ProductIDDescription': {'title': _('Description'), }, - '.hardware.support.cisco_contract:*.is_covered': {'title': _('is covered'), }, - '.hardware.support.cisco_contract:*.contract_site_customer_name': {'title': _('Customer name'), }, '.hardware.support.cisco_contract:*.contract_site_address1': {'title': _('Address'), }, '.hardware.support.cisco_contract:*.contract_site_city': {'title': _('City'), }, - '.hardware.support.cisco_contract:*.contract_site_state_province': {'title': _('State/Province'), }, '.hardware.support.cisco_contract:*.contract_site_country': {'title': _('Country'), }, - '.hardware.support.cisco_contract:*.service_line_descr': {'title': _('Service description'), }, - '.hardware.support.cisco_contract:*.service_contract_number': {'title': _('Contract number'), }, + '.hardware.support.cisco_contract:*.contract_site_customer_name': {'title': _('Customer name'), }, + '.hardware.support.cisco_contract:*.contract_site_state_province': {'title': _('State/Province'), }, + '.hardware.support.cisco_contract:*.covered_product_line_end_date': { + 'title': _('Contract end date'), 'paint': 'date_status' + }, + '.hardware.support.cisco_contract:*.is_covered': {'title': _('is covered'), }, '.hardware.support.cisco_contract:*.parent_sr_no': {'title': _('Parent S/N'), }, + '.hardware.support.cisco_contract:*.pid': {'title': _('PID (contract)'), }, + '.hardware.support.cisco_contract:*.serial_number': {'title': _('Serial number'), }, + '.hardware.support.cisco_contract:*.service_contract_number': {'title': _('Contract number'), }, + '.hardware.support.cisco_contract:*.service_line_descr': {'title': _('Service description'), }, + '.hardware.support.cisco_contract:*.warranty_end_date': {'title': _('Warranty end date'), }, '.hardware.support.cisco_contract:*.warranty_type': {'title': _('Warranty type'), }, '.hardware.support.cisco_contract:*.warranty_type_description': {'title': _('Warranty Description'), }, - '.hardware.support.cisco_contract:*.warranty_end_date': {'title': _('Warranty end date'), }, }) # BUG display hints @@ -221,18 +219,19 @@ inventory_displayhints.update({ ], 'view': 'invciscobugs_of_host', }, - '.software.support.cisco_bug.bugs:*.status': {'title': _('Status'), }, - '.software.support.cisco_bug.bugs:*.product': {'title': _('Product'), }, + '.software.support.cisco_bug.bugs:*.base_pid': {'title': _('Base PID'), }, + '.software.support.cisco_bug.bugs:*.behavior_changed': {'title': _('Behavior changed'), }, + '.software.support.cisco_bug.bugs:*.bug_id': {'title': _('Bug ID'), 'paint': 'bug_bugid'}, '.software.support.cisco_bug.bugs:*.description': {'title': _('Description'), }, '.software.support.cisco_bug.bugs:*.headline': {'title': _('Headline'), }, - '.software.support.cisco_bug.bugs:*.support_case_count': {'title': _('Support case count'), }, - '.software.support.cisco_bug.bugs:*.last_modified_date': {'title': _('Last modified date'), }, - '.software.support.cisco_bug.bugs:*.behavior_changed': {'title': _('Behavior changed'), }, - '.software.support.cisco_bug.bugs:*.base_pid': {'title': _('Base PID'), }, - '.software.support.cisco_bug.bugs:*.known_fixed_releases': {'title': _('Known fixed releases'), }, '.software.support.cisco_bug.bugs:*.id': {'title': _('ID'), }, '.software.support.cisco_bug.bugs:*.known_affected_releases': {'title': _('known affected releases'), }, + '.software.support.cisco_bug.bugs:*.known_fixed_releases': {'title': _('Known fixed releases'), }, + '.software.support.cisco_bug.bugs:*.last_modified_date': {'title': _('Last modified date'), }, + '.software.support.cisco_bug.bugs:*.product': {'title': _('Product'), }, '.software.support.cisco_bug.bugs:*.severity': {'title': _('Severity'), }, + '.software.support.cisco_bug.bugs:*.status': {'title': _('Status'), }, + '.software.support.cisco_bug.bugs:*.support_case_count': {'title': _('Support case count'), }, }) # PSIRT display hints @@ -249,74 +248,27 @@ inventory_displayhints.update({ ], 'view': 'invciscopsirt_of_host', }, + '.software.support.cisco_psirt.Last_checked': {'title': _('Last checked'), 'paint': 'last_checked_status'}, + '.software.support.cisco_psirt.advisories:*.advisoryId': {'title': _('Advisory ID'), 'paint': 'psirt_advisoryid'}, '.software.support.cisco_psirt.advisories:*.advisoryTitle': {'title': _('Advisory Title'), }, + '.software.support.cisco_psirt.advisories:*.bugIDs': {'title': _('Bug IDs'), 'paint': 'psirt_bugid'}, + '.software.support.cisco_psirt.advisories:*.cves': {'title': _('CVEs'), }, + '.software.support.cisco_psirt.advisories:*.cvrfUrl': {'title': _('CVRF URL')}, '.software.support.cisco_psirt.advisories:*.cvssBaseScore': {'title': _('CVSS base Score'), }, + '.software.support.cisco_psirt.advisories:*.cwe': {'title': _('CWE'), }, '.software.support.cisco_psirt.advisories:*.firstFixed': {'title': _('First fixed in'), }, '.software.support.cisco_psirt.advisories:*.firstPublished': {'title': _('First Published'), }, '.software.support.cisco_psirt.advisories:*.installed_version': {'title': _('OS version/family'), }, + '.software.support.cisco_psirt.advisories:*.ipsSignatures': {'title': _('IPS signatures')}, '.software.support.cisco_psirt.advisories:*.lastUpdated': {'title': _('Last Updated'), }, + '.software.support.cisco_psirt.advisories:*.ovalUrl': {'title': _('OVAL URL')}, + '.software.support.cisco_psirt.advisories:*.productNames': {'title': _('Product names'), }, '.software.support.cisco_psirt.advisories:*.publicationUrl': {'title': _('Public URL'), }, '.software.support.cisco_psirt.advisories:*.sir': {'title': _('Severity'), }, '.software.support.cisco_psirt.advisories:*.summary': {'title': _('Summary'), }, - '.software.support.cisco_psirt.advisories:*.cwe': {'title': _('CWE'), }, - '.software.support.cisco_psirt.advisories:*.cves': {'title': _('CVEs'), }, - '.software.support.cisco_psirt.advisories:*.productNames': {'title': _('Product names'), }, - '.software.support.cisco_psirt.advisories:*.ipsSignatures': {'title': _('IPS signatures')}, - '.software.support.cisco_psirt.advisories:*.cvrfUrl': {'title': _('CVRF URL')}, - '.software.support.cisco_psirt.advisories:*.ovalUrl': {'title': _('OVAL URL')}, - '.software.support.cisco_psirt.os_version': {'title': _('OS version')}, - '.software.support.cisco_psirt.not_updated_for_x_days': {'title': _('don\'t show advisories not updated for X days')}, '.software.support.cisco_psirt.dont_show_older_then': {'title': _('don\'t show advisories not updated after')}, + '.software.support.cisco_psirt.not_updated_for_x_days': { + 'title': _('don\'t show advisories not updated for X days') + }, + '.software.support.cisco_psirt.os_version': {'title': _('OS version')}, }) - - -if ENABLE_PAINTERS: - inventory_displayhints.update({ - # EoX - '.hardware.support.cisco_eox:*.EOXExternalAnnouncementDate': {'title': _('EOL Announcement'), 'paint': 'date_status'}, - '.hardware.support.cisco_eox:*.EndOfSvcAttachDate': {'title': _('End of service attachment'), 'paint': 'date_status'}, - '.hardware.support.cisco_eox:*.EndOfSecurityVulSupportDate': {'title': _('End of service vulnerability support'), 'paint': 'date_status'}, - '.hardware.support.cisco_eox:*.EndOfSWMaintenanceReleases': {'title': _('End of software maintenace releases'), 'paint': 'date_status'}, - '.hardware.support.cisco_eox:*.EndOfRoutineFailureAnalysisDate': {'title': _('End of routine failure analysis'), 'paint': 'date_status'}, - '.hardware.support.cisco_eox:*.EndOfSaleDate': {'title': _('End of sale'), 'paint': 'date_status'}, - '.hardware.support.cisco_eox:*.LastDateOfSupport': {'title': _('End of support'), 'paint': 'date_status'}, - '.hardware.support.cisco_eox:*.ProductBulletinNumber': {'title': _('EOL bulletin ID'), 'filter': FilterInvtableText,'paint': 'eox_eolid'}, - '.hardware.support.cisco_eox:*.Last_checked': {'title': _('Last checked'), 'paint': 'last_checked_status'}, - - # SN2Info - '.hardware.support.cisco_contract:*.Last_checked': {'title': _('Last checked'), 'paint': 'last_checked_status'}, - '.hardware.support.cisco_contract:*.covered_product_line_end_date': {'title': _('Contract end date'), 'paint': 'date_status'}, - - # Bug - '.software.support.cisco_bug.bugs:*.bug_id': {'title': _('Bug ID'), 'paint': 'bug_bugid'}, - - # Psirt - '.software.support.cisco_psirt.advisories:*.advisoryId': {'title': _('Advisory ID'), 'paint': 'psirt_advisoryid'}, - '.software.support.cisco_psirt.advisories:*.bugIDs': {'title': _('Bug IDs'), 'paint': 'psirt_bugid'}, - '.software.support.cisco_psirt.Last_checked': {'title': _('Last checked'), 'paint': 'last_checked_status'}, - }) -else: - inventory_displayhints.update(({ - # EoX - '.hardware.support.cisco_eox:*.EOXExternalAnnouncementDate': {'title': _('EOL Announcement')}, - '.hardware.support.cisco_eox:*.EndOfSvcAttachDate': {'title': _('End of service attachment')}, - '.hardware.support.cisco_eox:*.EndOfSecurityVulSupportDate': {'title': _('End of service vulnerability support')}, - '.hardware.support.cisco_eox:*.EndOfSWMaintenanceReleases': {'title': _('End of software maintenace releases')}, - '.hardware.support.cisco_eox:*.EndOfRoutineFailureAnalysisDate': {'title': _('End of routine failure analysis')}, - '.hardware.support.cisco_eox:*.EndOfSaleDate': {'title': _('End of sale')}, - '.hardware.support.cisco_eox:*.LastDateOfSupport': {'title': _('End of support')}, - '.hardware.support.cisco_eox:*.ProductBulletinNumber': {'title': _('EOL bulletin ID')}, - '.hardware.support.cisco_eox:*.Last_checked': {'title': _('Last checked'),}, - - # SN2Info - '.hardware.support.cisco_contract:*.Last_checked': {'title': _('Last checked')}, - '.hardware.support.cisco_contract:*.covered_product_line_end_date': {'title': _('Contract end date')}, - - # Bug - '.software.support.cisco_bug.bugs:*.bug_id': {'title': _('Bug ID')}, - - # Psirt - '.software.support.cisco_psirt.advisories:*.advisoryId': {'title': _('Advisory ID')}, - '.software.support.cisco_psirt.advisories:*.bugIDs': {'title': _('Bug IDs')}, - '.software.support.cisco_psirt.Last_checked': {'title': _('Last checked')}, - }))