Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-ciscoconfparse for 
openSUSE:Factory checked in at 2021-02-19 23:43:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ciscoconfparse (Old)
 and      /work/SRC/openSUSE:Factory/.python-ciscoconfparse.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-ciscoconfparse"

Fri Feb 19 23:43:05 2021 rev:18 rq:866283 version:1.5.25

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-ciscoconfparse/python-ciscoconfparse.changes  
    2021-01-22 21:53:28.765947400 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-ciscoconfparse.new.28504/python-ciscoconfparse.changes
   2021-02-19 23:44:46.755334801 +0100
@@ -1,0 +2,9 @@
+Sat Jan 23 18:32:44 UTC 2021 - Ben Greiner <[email protected]>
+
+- Update to version 1.5.25
+  * Fix Github Issue gh#mpenning/ciscoconfparse#195
+  * merge PR gh#mpenning/ciscoconfparse#194
+  * fix multiple unreported bugs in ccp_util.L4Object()
+- Drop remove-mock.patch and test-lists.patch fixed upstream
+
+-------------------------------------------------------------------

Old:
----
  ciscoconfparse-1.5.24.tar.gz
  remove-mock.patch
  test-lists.patch

New:
----
  ciscoconfparse-1.5.25.tar.gz

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

Other differences:
------------------
++++++ python-ciscoconfparse.spec ++++++
--- /var/tmp/diff_new_pack.fvBTQN/_old  2021-02-19 23:44:47.235335271 +0100
+++ /var/tmp/diff_new_pack.fvBTQN/_new  2021-02-19 23:44:47.235335271 +0100
@@ -19,16 +19,12 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %bcond_without python2
 Name:           python-ciscoconfparse
-Version:        1.5.24
+Version:        1.5.25
 Release:        0
 Summary:        Library for parsing, querying and modifying Cisco IOS-style 
configurations
 License:        GPL-3.0-or-later
 URL:            https://github.com/mpenning/ciscoconfparse
 Source:         
https://files.pythonhosted.org/packages/source/c/ciscoconfparse/ciscoconfparse-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM remove-mock.patch -- gh#mpenning/ciscoconfparse#194
-Patch0:         remove-mock.patch
-# PATCH-FIX-UPSTREAM test-lists.patch -- gh#mpenning/ciscoconfparse#195
-Patch1:         test-lists.patch
 BuildRequires:  %{python_module colorama}
 BuildRequires:  %{python_module dnspython}
 BuildRequires:  %{python_module passlib}

++++++ ciscoconfparse-1.5.24.tar.gz -> ciscoconfparse-1.5.25.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ciscoconfparse-1.5.24/CHANGES 
new/ciscoconfparse-1.5.25/CHANGES
--- old/ciscoconfparse-1.5.24/CHANGES   2021-01-06 20:07:15.000000000 +0100
+++ new/ciscoconfparse-1.5.25/CHANGES   2021-01-23 17:54:16.000000000 +0100
@@ -1,4 +1,5 @@
-1.5.23  20210106 Fix Github Issue #178
+1.5.25  20210123 Fix Github Issue #195, merge PR #194, fix multiple unreported 
bugs in ccp_util.L4Object()
+1.5.24  20210106 Fix Github Issue #178
 1.5.23  20210105 Prevent find_object_branches() from using None
 1.5.22  20201127 Fix Github issue #186 (replace variables named input)
 1.5.21  20201127 Fix Github issue #187
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ciscoconfparse-1.5.24/PKG-INFO 
new/ciscoconfparse-1.5.25/PKG-INFO
--- old/ciscoconfparse-1.5.24/PKG-INFO  2021-01-06 20:08:06.000000000 +0100
+++ new/ciscoconfparse-1.5.25/PKG-INFO  2021-01-23 18:04:18.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: ciscoconfparse
-Version: 1.5.24
+Version: 1.5.25
 Summary: Parse, Audit, Query, Build, and Modify Cisco IOS-style configurations
 Home-page: http://www.pennington.net/py/ciscoconfparse/
 Author: David Michael Pennington
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ciscoconfparse-1.5.24/ciscoconfparse/ccp_util.py 
new/ciscoconfparse-1.5.25/ciscoconfparse/ccp_util.py
--- old/ciscoconfparse-1.5.24/ciscoconfparse/ccp_util.py        2020-12-06 
16:27:40.000000000 +0100
+++ new/ciscoconfparse-1.5.25/ciscoconfparse/ccp_util.py        2021-01-23 
17:57:34.000000000 +0100
@@ -1062,7 +1062,20 @@
 
 
 class L4Object(object):
-    """Object for Transport-layer protocols; the object ensures that logical 
operators (such as le, gt, eq, and ne) are parsed correctly, as well as mapping 
service names to port numbers"""
+    """Object for Transport-layer protocols; the object ensures that logical 
operators (such as le, gt, eq, and ne) are parsed correctly, as well as mapping 
service names to port numbers
+    
+    Examples
+    --------
+    >>> from ciscoconfparse.ccp_util import L4Object
+    >>> obj = L4Object(protocol="tcp", port_spec="range ssh smtp", 
syntax="asa")
+    >>> obj
+    <L4Object tcp [22, 23, 24, 25]>
+    >>> obj.protocol
+    "tcp"
+    >>> 25 in obj.port_list
+    True
+    >>>
+    """
 
     def __init__(self, protocol="", port_spec="", syntax=""):
         self.protocol = protocol
@@ -1086,29 +1099,39 @@
         else:
             raise NotImplementedError("This syntax is unknown: 
'{0}'".format(syntax))
 
-        if "eq " in port_spec:
-            port_str = re.split("\s+", port_spec)[-1]
-            self.port_list = [int(ports.get(port_str, port_str))]
-        elif re.search(r"^\S+$", port_spec):
+        if "eq " in port_spec.strip():
+            port_tmp = re.split("\s+", port_spec)[-1].strip()
+            eq_port = int(ports.get(port_tmp, port_tmp))
+            assert 1 <= eq_port <= 65535
+            self.port_list = [eq_port]
+        elif re.search(r"^\S+$", port_spec.strip()):
             # Technically, 'eq ' is optional...
-            self.port_list = [int(ports.get(port_spec, port_spec))]
-        elif "range " in port_spec:
+            eq_port = int(ports.get(port_spec.strip(), port_spec.strip()))
+            assert 1 <= eq_port <= 65535
+            self.port_list = [eq_port]
+        elif "range " in port_spec.strip():
             port_tmp = re.split("\s+", port_spec)[1:]
-            self.port_list = range(
-                int(ports.get(port_tmp[0], port_tmp[0])),
-                int(ports.get(port_tmp[1], port_tmp[1])) + 1,
-            )
-        elif "lt " in port_spec:
-            port_str = re.split("\s+", port_spec)[-1]
-            self.port_list = range(1, int(ports.get(port_str, port_str)))
-        elif "gt " in port_spec:
+            low_port = int(ports.get(port_tmp[0], port_tmp[0]))
+            high_port = int(ports.get(port_tmp[1], port_tmp[1]))
+            assert low_port <= high_port
+            self.port_list = sorted(range(low_port, high_port+1))
+        elif "lt " in port_spec.strip():
+            port_tmp = re.split("\s+", port_spec)[-1]
+            high_port = int(ports.get(port_tmp, port_tmp))
+            assert 65535 >= high_port >= 2
+            self.port_list = sorted(range(1, high_port))
+        elif "gt " in port_spec.strip():
+            port_tmp = re.split("\s+", port_spec)[-1]
+            low_port = int(ports.get(port_tmp, port_tmp))
+            assert 0 < low_port < 65535
+            self.port_list = sorted(range(low_port+1, 65536))
+        elif "neq " in port_spec.strip():
             port_str = re.split("\s+", port_spec)[-1]
-            self.port_list = range(int(ports.get(port_str, port_str)) + 1, 
65535)
-        elif "neq " in port_spec:
-            port_str = re.split("\s+", port_spec)[-1]
-            tmp = set(range(1, 65535))
+            tmp = set(range(1, 65536))
             tmp.remove(int(port_str))
             self.port_list = sorted(tmp)
+        else:
+            raise NotImplementedError("This port_spec is unknown: 
'{0}'".format(port_spec))
 
     def __eq__(self, val):
         if (self.protocol == val.protocol) and (self.port_list == 
val.port_list):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ciscoconfparse-1.5.24/ciscoconfparse/version.json 
new/ciscoconfparse-1.5.25/ciscoconfparse/version.json
--- old/ciscoconfparse-1.5.24/ciscoconfparse/version.json       2021-01-06 
20:07:33.000000000 +0100
+++ new/ciscoconfparse-1.5.25/ciscoconfparse/version.json       2021-01-23 
17:52:06.000000000 +0100
@@ -1,3 +1,3 @@
 {
-    "version": "1.5.24"
+    "version": "1.5.25"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ciscoconfparse-1.5.24/ciscoconfparse.egg-info/PKG-INFO 
new/ciscoconfparse-1.5.25/ciscoconfparse.egg-info/PKG-INFO
--- old/ciscoconfparse-1.5.24/ciscoconfparse.egg-info/PKG-INFO  2021-01-06 
20:08:02.000000000 +0100
+++ new/ciscoconfparse-1.5.25/ciscoconfparse.egg-info/PKG-INFO  2021-01-23 
18:04:14.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: ciscoconfparse
-Version: 1.5.24
+Version: 1.5.25
 Summary: Parse, Audit, Query, Build, and Modify Cisco IOS-style configurations
 Home-page: http://www.pennington.net/py/ciscoconfparse/
 Author: David Michael Pennington
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ciscoconfparse-1.5.24/tests/test_Ccp_Util.py 
new/ciscoconfparse-1.5.25/tests/test_Ccp_Util.py
--- old/ciscoconfparse-1.5.24/tests/test_Ccp_Util.py    2020-11-25 
15:36:40.000000000 +0100
+++ new/ciscoconfparse-1.5.25/tests/test_Ccp_Util.py    2021-01-23 
17:46:01.000000000 +0100
@@ -99,14 +99,18 @@
 def testL4Object_asa_range01():
     pp = L4Object(protocol="tcp", port_spec="range smtp 32", syntax="asa")
     assert pp.protocol == "tcp"
-    assert pp.port_list == range(25, 33)
+    assert pp.port_list == sorted(range(25, 33))
 
 
 def testL4Object_asa_lt01():
     pp = L4Object(protocol="tcp", port_spec="lt echo", syntax="asa")
     assert pp.protocol == "tcp"
-    assert pp.port_list == range(1, 7)
+    assert pp.port_list ==sorted(range(1, 7))
 
+def testL4Object_asa_gt01():
+    pp = L4Object(protocol="tcp", port_spec="gt 65534", syntax="asa")
+    assert pp.protocol == "tcp"
+    assert pp.port_list ==[65535]
 
 @pytest.mark.xfail(
     sys.version_info[0] == 3 and sys.version_info[1] == 2,
@@ -115,7 +119,7 @@
 def testL4Object_asa_lt02():
     pp = L4Object(protocol="tcp", port_spec="lt 7", syntax="asa")
     assert pp.protocol == "tcp"
-    assert pp.port_list == range(1, 7)
+    assert pp.port_list == sorted(range(1, 7))
 
 
 def testIPv4Obj_contain():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ciscoconfparse-1.5.24/tests/test_CiscoConfParse.py 
new/ciscoconfparse-1.5.25/tests/test_CiscoConfParse.py
--- old/ciscoconfparse-1.5.24/tests/test_CiscoConfParse.py      2020-12-05 
18:11:41.000000000 +0100
+++ new/ciscoconfparse-1.5.25/tests/test_CiscoConfParse.py      2021-01-23 
17:55:43.000000000 +0100
@@ -1,7 +1,10 @@
 from operator import attrgetter
 from itertools import repeat
 from copy import deepcopy
-from mock import patch
+try:
+    from unittest.mock import patch
+except ImportError:
+    from mock import patch
 import platform
 import sys
 import re
@@ -776,6 +779,49 @@
     result_correct = [[None, None, None, None, None]]
     assert test_result == result_correct
 
+def testValues_find_object_branches_05():
+    """Basic test: find_object_branches() - Test that non-existent regex child 
levels are returned if allow_none=True (see Github Issue #178)"""
+    test_data = ['thisis',
+        '    atest',
+        '        ofbranchsearch',
+        'thisis',
+        '    atest',
+        '        matchthis',
+        ]
+
+    parse = CiscoConfParse(test_data)
+
+    branchspec = (r"^this", r"^\s+atest", r"^\s+matchthis")
+    test_result = parse.find_object_branches(branchspec, allow_none=True)
+
+    assert len(test_result)==2
+    assert test_result[0][0].text.strip() == "thisis"
+    assert test_result[0][1].text.strip() == "atest"
+    assert test_result[0][2] is None
+    assert test_result[1][0].text.strip() == "thisis"
+    assert test_result[1][1].text.strip() == "atest"
+    assert test_result[1][2].text.strip() == "matchthis"
+
+def testValues_find_object_branches_06():
+    """Basic test: find_object_branches() - Test that non-existent regex child 
levels are not returned if allow_none=False (see Github Issue #178)"""
+    test_data = ['thisis',
+        '    atest',
+        '        ofbranchsearch',
+        'thisis',
+        '    atest',
+        '        matchthis',
+        ]
+
+    parse = CiscoConfParse(test_data)
+
+    branchspec = (r"^this", r"^\s+atest", r"^\s+matchthis")
+    test_result = parse.find_object_branches(branchspec, allow_none=False)
+
+    assert len(test_result)==1
+    assert test_result[0][0].text.strip() == "thisis"
+    assert test_result[0][1].text.strip() == "atest"
+    assert test_result[0][2].text.strip() == "matchthis"
+
 
 def testValues_find_objects_w_parents(parse_c01):
     c01_children_w_parents_switchport = [

Reply via email to