Hello community,

here is the log from the commit of package prometheus-webhook-snmp for 
openSUSE:Factory checked in at 2020-05-28 09:20:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/prometheus-webhook-snmp (Old)
 and      /work/SRC/openSUSE:Factory/.prometheus-webhook-snmp.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "prometheus-webhook-snmp"

Thu May 28 09:20:51 2020 rev:3 rq:809678 version:1.4

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/prometheus-webhook-snmp/prometheus-webhook-snmp.changes
  2020-05-12 22:33:42.116040897 +0200
+++ 
/work/SRC/openSUSE:Factory/.prometheus-webhook-snmp.new.3606/prometheus-webhook-snmp.changes
        2020-05-28 09:21:58.301506018 +0200
@@ -1,0 +2,6 @@
+Thu May 14 12:23:05 UTC 2020 - Volker Theile <[email protected]>
+
+- Update to version 1.4
+  * Issue #22: Prevent Python type errors when sending an SNMP trap. 
(bsc#1172083)
+
+-------------------------------------------------------------------

Old:
----
  prometheus-webhook-snmp-1.3.tar.gz

New:
----
  prometheus-webhook-snmp-1.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ prometheus-webhook-snmp.spec ++++++
--- /var/tmp/diff_new_pack.pVlMbf/_old  2020-05-28 09:21:59.141507872 +0200
+++ /var/tmp/diff_new_pack.pVlMbf/_new  2020-05-28 09:21:59.141507872 +0200
@@ -15,7 +15,7 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 
 Name:           prometheus-webhook-snmp
-Version:        1.3
+Version:        1.4
 Release:        0
 Summary:        Prometheus Alertmanager receiver for SNMP traps
 License:        GPL-3.0

++++++ prometheus-webhook-snmp-1.3.tar.gz -> prometheus-webhook-snmp-1.4.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/prometheus-webhook-snmp-1.3/CHANGELOG.md 
new/prometheus-webhook-snmp-1.4/CHANGELOG.md
--- old/prometheus-webhook-snmp-1.3/CHANGELOG.md        2020-03-25 
09:48:10.000000000 +0100
+++ new/prometheus-webhook-snmp-1.4/CHANGELOG.md        2020-05-14 
13:52:30.000000000 +0200
@@ -1,3 +1,6 @@
+v1.4
+  * Issue #22: Prevent Python type errors when sending an SNMP trap.
+
 v1.3
 
   * Add 'trap-default-severity' configuration option.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/prometheus-webhook-snmp-1.3/prometheus-webhook-snmp 
new/prometheus-webhook-snmp-1.4/prometheus-webhook-snmp
--- old/prometheus-webhook-snmp-1.3/prometheus-webhook-snmp     2020-03-25 
09:48:10.000000000 +0100
+++ new/prometheus-webhook-snmp-1.4/prometheus-webhook-snmp     2020-05-14 
13:52:30.000000000 +0200
@@ -8,7 +8,7 @@
 from prometheus_webhook_snmp import utils
 
 
-__version__ = "1.3"
+__version__ = "1.4"
 
 
 pass_context = click.make_pass_decorator(utils.Context, ensure=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/prometheus-webhook-snmp-1.3/prometheus-webhook-snmp.spec 
new/prometheus-webhook-snmp-1.4/prometheus-webhook-snmp.spec
--- old/prometheus-webhook-snmp-1.3/prometheus-webhook-snmp.spec        
2020-03-25 09:48:10.000000000 +0100
+++ new/prometheus-webhook-snmp-1.4/prometheus-webhook-snmp.spec        
2020-05-14 13:52:30.000000000 +0200
@@ -15,7 +15,7 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 
 Name:           prometheus-webhook-snmp
-Version:        1.3
+Version:        1.4
 Release:        0
 Summary:        Prometheus Alertmanager receiver for SNMP traps
 License:        GPL-3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/prometheus-webhook-snmp-1.3/prometheus_webhook_snmp/utils.py 
new/prometheus-webhook-snmp-1.4/prometheus_webhook_snmp/utils.py
--- old/prometheus-webhook-snmp-1.3/prometheus_webhook_snmp/utils.py    
2020-03-25 09:48:10.000000000 +0100
+++ new/prometheus-webhook-snmp-1.4/prometheus_webhook_snmp/utils.py    
2020-05-14 13:52:30.000000000 +0200
@@ -135,17 +135,17 @@
     var_binds = hlapi.NotificationType(hlapi.ObjectIdentity(trap_data['oid']))
     var_binds.addVarBinds(
         hlapi.ObjectType(hlapi.ObjectIdentity(oids['alertname']),
-                         hlapi.OctetString(trap_data['alertname'])),
+                         hlapi.OctetString(trap_data['alertname'] or '')),
         hlapi.ObjectType(hlapi.ObjectIdentity(oids['status']),
                          hlapi.OctetString(trap_data['status'])),
         hlapi.ObjectType(hlapi.ObjectIdentity(oids['severity']),
                          hlapi.OctetString(trap_data['severity'])),
         hlapi.ObjectType(hlapi.ObjectIdentity(oids['instance']),
-                         hlapi.OctetString(trap_data['instance'])),
+                         hlapi.OctetString(trap_data['instance'] or '')),
         hlapi.ObjectType(hlapi.ObjectIdentity(oids['job']),
-                         hlapi.OctetString(trap_data['job'])),
+                         hlapi.OctetString(trap_data['job'] or '')),
         hlapi.ObjectType(hlapi.ObjectIdentity(oids['description']),
-                         hlapi.OctetString(trap_data['description'])),
+                         hlapi.OctetString(trap_data['description'] or '')),
         hlapi.ObjectType(hlapi.ObjectIdentity(oids['labels']),
                          hlapi.OctetString(json.dumps(trap_data['labels']))),
         hlapi.ObjectType(hlapi.ObjectIdentity(oids['timestamp']),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/prometheus-webhook-snmp-1.3/tests/test_misc.py 
new/prometheus-webhook-snmp-1.4/tests/test_misc.py
--- old/prometheus-webhook-snmp-1.3/tests/test_misc.py  2020-03-25 
09:48:10.000000000 +0100
+++ new/prometheus-webhook-snmp-1.4/tests/test_misc.py  2020-05-14 
13:52:30.000000000 +0200
@@ -3,7 +3,8 @@
 
 from pyfakefs import fake_filesystem
 
-from prometheus_webhook_snmp.utils import parse_notification, Config
+from prometheus_webhook_snmp.utils import parse_notification, Config, \
+    send_snmp_trap
 
 NOTIFICATION_FIRING = {
     'receiver': 'test-01',
@@ -79,7 +80,8 @@
     def test_parse_notification(self):
         trap_data = parse_notification({
             'alert_oid_label': 'oid',
-            'trap_default_oid': '1.2.3.4'
+            'trap_default_oid': '1.2.3.4',
+            'trap_default_severity': ''
         }, NOTIFICATION_FIRING)
         self.assertIsInstance(trap_data, list)
         trap_data = trap_data[0]
@@ -98,7 +100,8 @@
     def test_parse_notification_no_oid(self):
         trap_data = parse_notification({
             'alert_oid_label': 'oid',
-            'trap_default_oid': '1.2.3.4'
+            'trap_default_oid': '1.2.3.4',
+            'trap_default_severity': ''
         }, NOTIFICATION_RESOLVED)
         self.assertIsInstance(trap_data, list)
         trap_data = trap_data[0]
@@ -114,6 +117,22 @@
         self.assertEqual(trap_data['timestamp'], 1554110387)
         self.assertIsInstance(trap_data['rawdata'], dict)
 
+    def test_send_snmp_trap(self):
+        config = Config()
+        self.assertIsInstance(config['trap_default_severity'], str)
+        send_snmp_trap(config, {
+            'oid': '1.3.6.1.4.1.50495.15.1.2.1',
+            'alertname': None,
+            'status': 'resolved',
+            'severity': config['trap_default_severity'],
+            'instance': None,
+            'job': None,
+            'description': None,
+            'labels': {},
+            'timestamp': 1554110387,
+            'rawdata': {}
+        })
+
 
 class ConfigTestCase(unittest.TestCase):
     fs = fake_filesystem.FakeFilesystem()


Reply via email to