trigger 2.3.1__tar.gz → 2.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. {trigger-2.3.1/trigger.egg-info → trigger-2.3.2}/PKG-INFO +1 -1
  2. {trigger-2.3.1 → trigger-2.3.2}/pyproject.toml +4 -1
  3. {trigger-2.3.1 → trigger-2.3.2}/tests/test_acl.py +71 -0
  4. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/support.py +16 -4
  5. {trigger-2.3.1 → trigger-2.3.2/trigger.egg-info}/PKG-INFO +1 -1
  6. {trigger-2.3.1 → trigger-2.3.2}/AUTHORS.md +0 -0
  7. {trigger-2.3.1 → trigger-2.3.2}/LICENSE.md +0 -0
  8. {trigger-2.3.1 → trigger-2.3.2}/README.md +0 -0
  9. {trigger-2.3.1 → trigger-2.3.2}/setup.cfg +0 -0
  10. {trigger-2.3.1 → trigger-2.3.2}/tests/test_acl_db.py +0 -0
  11. {trigger-2.3.1 → trigger-2.3.2}/tests/test_acl_queue.py +0 -0
  12. {trigger-2.3.1 → trigger-2.3.2}/tests/test_changemgmt.py +0 -0
  13. {trigger-2.3.1 → trigger-2.3.2}/tests/test_except.py +0 -0
  14. {trigger-2.3.1 → trigger-2.3.2}/tests/test_netdevices.py +0 -0
  15. {trigger-2.3.1 → trigger-2.3.2}/tests/test_scripts.py +0 -0
  16. {trigger-2.3.1 → trigger-2.3.2}/tests/test_tacacsrc.py +0 -0
  17. {trigger-2.3.1 → trigger-2.3.2}/tests/test_templates.py +0 -0
  18. {trigger-2.3.1 → trigger-2.3.2}/tests/test_twister.py +0 -0
  19. {trigger-2.3.1 → trigger-2.3.2}/tests/test_twister2.py +0 -0
  20. {trigger-2.3.1 → trigger-2.3.2}/tests/test_utils.py +0 -0
  21. {trigger-2.3.1 → trigger-2.3.2}/trigger/__init__.py +0 -0
  22. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/__init__.py +0 -0
  23. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/autoacl.py +0 -0
  24. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/db.py +0 -0
  25. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/dicts.py +0 -0
  26. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/grammar.py +0 -0
  27. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/ios.py +0 -0
  28. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/junos.py +0 -0
  29. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/models.py +0 -0
  30. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/parser.py +0 -0
  31. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/queue.py +0 -0
  32. {trigger-2.3.1 → trigger-2.3.2}/trigger/acl/tools.py +0 -0
  33. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/__init__.py +0 -0
  34. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/acl.py +0 -0
  35. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/acl_script.py +0 -0
  36. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/aclconv.py +0 -0
  37. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/check_access.py +0 -0
  38. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/check_syntax.py +0 -0
  39. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/fe.py +0 -0
  40. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/find_access.py +0 -0
  41. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/gnng.py +0 -0
  42. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/gong.py +0 -0
  43. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/load_acl.py +0 -0
  44. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/load_config.py +0 -0
  45. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/netdev.py +0 -0
  46. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/optimizer.py +0 -0
  47. {trigger-2.3.1 → trigger-2.3.2}/trigger/bin/run_cmds.py +0 -0
  48. {trigger-2.3.1 → trigger-2.3.2}/trigger/changemgmt/__init__.py +0 -0
  49. {trigger-2.3.1 → trigger-2.3.2}/trigger/changemgmt/bounce.py +0 -0
  50. {trigger-2.3.1 → trigger-2.3.2}/trigger/cmds.py +0 -0
  51. {trigger-2.3.1 → trigger-2.3.2}/trigger/conf/__init__.py +0 -0
  52. {trigger-2.3.1 → trigger-2.3.2}/trigger/conf/global_settings.py +0 -0
  53. {trigger-2.3.1 → trigger-2.3.2}/trigger/contrib/__init__.py +0 -0
  54. {trigger-2.3.1 → trigger-2.3.2}/trigger/exceptions.py +0 -0
  55. {trigger-2.3.1 → trigger-2.3.2}/trigger/gorc.py +0 -0
  56. {trigger-2.3.1 → trigger-2.3.2}/trigger/netdevices/__init__.py +0 -0
  57. {trigger-2.3.1 → trigger-2.3.2}/trigger/netdevices/loader.py +0 -0
  58. {trigger-2.3.1 → trigger-2.3.2}/trigger/netscreen.py +0 -0
  59. {trigger-2.3.1 → trigger-2.3.2}/trigger/packages/__init__.py +0 -0
  60. {trigger-2.3.1 → trigger-2.3.2}/trigger/packages/peewee.py +0 -0
  61. {trigger-2.3.1 → trigger-2.3.2}/trigger/rancid.py +0 -0
  62. {trigger-2.3.1 → trigger-2.3.2}/trigger/tacacsrc.py +0 -0
  63. {trigger-2.3.1 → trigger-2.3.2}/trigger/twister.py +0 -0
  64. {trigger-2.3.1 → trigger-2.3.2}/trigger/twister2.py +0 -0
  65. {trigger-2.3.1 → trigger-2.3.2}/trigger/utils/__init__.py +0 -0
  66. {trigger-2.3.1 → trigger-2.3.2}/trigger/utils/cli.py +0 -0
  67. {trigger-2.3.1 → trigger-2.3.2}/trigger/utils/importlib.py +0 -0
  68. {trigger-2.3.1 → trigger-2.3.2}/trigger/utils/network.py +0 -0
  69. {trigger-2.3.1 → trigger-2.3.2}/trigger/utils/rcs.py +0 -0
  70. {trigger-2.3.1 → trigger-2.3.2}/trigger/utils/templates.py +0 -0
  71. {trigger-2.3.1 → trigger-2.3.2}/trigger/utils/url.py +0 -0
  72. {trigger-2.3.1 → trigger-2.3.2}/trigger/utils/xmltodict.py +0 -0
  73. {trigger-2.3.1 → trigger-2.3.2}/trigger.egg-info/SOURCES.txt +0 -0
  74. {trigger-2.3.1 → trigger-2.3.2}/trigger.egg-info/dependency_links.txt +0 -0
  75. {trigger-2.3.1 → trigger-2.3.2}/trigger.egg-info/entry_points.txt +0 -0
  76. {trigger-2.3.1 → trigger-2.3.2}/trigger.egg-info/requires.txt +0 -0
  77. {trigger-2.3.1 → trigger-2.3.2}/trigger.egg-info/top_level.txt +0 -0
  78. {trigger-2.3.1 → trigger-2.3.2}/twisted/plugins/trigger_xmlrpc.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trigger
3
- Version: 2.3.1
3
+ Version: 2.3.2
4
4
  Summary: Network automation toolkit for managing network devices
5
5
  Author-email: Jathan McCollum <jathan@gmail.com>
6
6
  License-Expression: BSD-3-Clause
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "trigger"
7
- version = "2.3.1"
7
+ version = "2.3.2"
8
8
  description = "Network automation toolkit for managing network devices"
9
9
  readme = "README.md"
10
10
  license = "BSD-3-Clause"
@@ -119,6 +119,9 @@ ignore = [
119
119
 
120
120
  # --- Kept from v2.0.0 baseline ---
121
121
  "E501", # line-too-long (handled by formatter)
122
+ "PLR0917", # too-many-positional-arguments (newly enforced in ruff 0.16;
123
+ # incompatible with Twisted-style long method signatures
124
+ # used throughout the codebase)
122
125
  ]
123
126
 
124
127
  [tool.ruff.lint.pydocstyle]
@@ -392,6 +392,77 @@ ipv4 access-list BLAHBLAH
392
392
  self.assertRaises(exceptions.BadACLName, a.output_ios)
393
393
 
394
394
 
395
+ class CheckStringification(unittest.TestCase):
396
+ """Test str() and family kwarg tolerance of ACL output methods.
397
+
398
+ Regression tests for issue #397: ACL.__str__ always forwards
399
+ ``family=self.family`` through ACL.output(), but only output_junos()
400
+ accepted it, so str() raised TypeError for every other format.
401
+ """
402
+
403
+ def setUp(self):
404
+ super().setUp()
405
+ self.a = acl.ACL(name="BLAHBLAH")
406
+ self.t1 = acl.Term(name="p99")
407
+ self.t1.match["protocol"] = ["tcp"]
408
+ self.t1.match["source-address"] = ["192.0.2.0/24"]
409
+ self.t1.match["destination-port"] = [22]
410
+ self.t1.action = "accept"
411
+ self.a.terms.append(self.t1)
412
+
413
+ def _check_str(self, fmt, name="BLAHBLAH", term_name="p99"):
414
+ """Helper: str() renders without TypeError for the given format."""
415
+ self.a.format = fmt
416
+ self.a.name = name
417
+ self.t1.name = term_name
418
+ lines = str(self.a).splitlines()
419
+ self.assertTrue(lines)
420
+ return lines
421
+
422
+ def testStrJunOS(self):
423
+ """Test str() on a JunOS ACL"""
424
+ self._check_str("junos", "100j")
425
+
426
+ def testStrIOS(self):
427
+ """Test str() on a traditional IOS ACL"""
428
+ self._check_str("ios", "100", term_name=None)
429
+
430
+ def testStrIOSNamed(self):
431
+ """Test str() on a named IOS ACL (the #397 crash)"""
432
+ lines = self._check_str("ios_named")
433
+ self.assertEqual(lines[0], "ip access-list extended BLAHBLAH")
434
+
435
+ def testStrIOSXR(self):
436
+ """Test str() on an IOS XR ACL"""
437
+ self._check_str("iosxr", term_name=None)
438
+
439
+ def testStrIOSBrocade(self):
440
+ """Test str() on a Brocade-flavored IOS ACL"""
441
+ self._check_str("ios_brocade", "100", term_name=None)
442
+
443
+ def testParseStrRoundTrip(self):
444
+ """Test str() on a parsed named IOS ACL round-trips (issue #397 repro)"""
445
+ text = "ip access-list extended SMOKE\n permit tcp host 10.20.30.40 any eq 22\n deny ip any any log\n"
446
+ a = acl.parse(text)
447
+ self.assertEqual(str(a), text.strip())
448
+
449
+ def testFamilyKwargAccepted(self):
450
+ """Test ACL-level output methods accept and ignore family kwarg"""
451
+ for fmt, name, term_name in (
452
+ ("junos", "100j", "p99"),
453
+ ("ios", "100", None),
454
+ ("ios_named", "BLAHBLAH", "p99"),
455
+ ("iosxr", "BLAHBLAH", None),
456
+ ("ios_brocade", "100", None),
457
+ ):
458
+ self.a.format = fmt
459
+ self.a.name = name
460
+ self.t1.name = term_name
461
+ with_family = self.a.output(family="inet")
462
+ without_family = self.a.output()
463
+ self.assertEqual(with_family, without_family, f"format={fmt}")
464
+
465
+
395
466
  class CheckIOSParseAndOutput(unittest.TestCase):
396
467
  """Test parsing of IOS ACLs"""
397
468
 
@@ -758,10 +758,13 @@ class ACL:
758
758
 
759
759
  return out
760
760
 
761
- def output_ios(self, replace=False):
761
+ def output_ios(self, replace=False, family=None):
762
762
  """Output the ACL in IOS traditional format.
763
763
 
764
764
  :param replace: If set the ACL is preceded by a ``no access-list`` line.
765
+ :param family: Accepted for signature compatibility with
766
+ :meth:`~ACL.output_junos`, but ignored -- ``family inet/inet6``
767
+ wrapping is a JunOS-only concept.
765
768
  """
766
769
  if self.name is None:
767
770
  msg = "IOS format requires a name"
@@ -785,7 +788,7 @@ class ACL:
785
788
  out += [x for x in t.output_ios(prefix)]
786
789
  return out
787
790
 
788
- def output_ios_brocade(self, replace=False, receive_acl=False):
791
+ def output_ios_brocade(self, replace=False, receive_acl=False, family=None):
789
792
  """Output the ACL in Brocade-flavored IOS format.
790
793
 
791
794
  The difference between this and "traditional" IOS are:
@@ -796,6 +799,9 @@ class ACL:
796
799
  :param replace: If set the ACL is preceded by a ``no access-list`` line.
797
800
  :param receive_acl: If set the ACL is suffixed with a ``ip
798
801
  rebind-receive-acl' instead of ``ip rebind-acl``.
802
+ :param family: Accepted for signature compatibility with
803
+ :meth:`~ACL.output_junos`, but ignored -- ``family inet/inet6``
804
+ wrapping is a JunOS-only concept.
799
805
  """
800
806
  self.strip_comments()
801
807
 
@@ -812,10 +818,13 @@ class ACL:
812
818
 
813
819
  return out
814
820
 
815
- def output_ios_named(self, replace=False):
821
+ def output_ios_named(self, replace=False, family=None):
816
822
  """Output the ACL in IOS named format.
817
823
 
818
824
  :param replace: If set the ACL is preceded by a ``no access-list`` line.
825
+ :param family: Accepted for signature compatibility with
826
+ :meth:`~ACL.output_junos`, but ignored -- ``family inet/inet6``
827
+ wrapping is a JunOS-only concept.
819
828
  """
820
829
  if self.name is None:
821
830
  msg = "IOS format requires a name"
@@ -831,10 +840,13 @@ class ACL:
831
840
  out += [x for x in t.output_ios_named(" ")]
832
841
  return out
833
842
 
834
- def output_iosxr(self, replace=False):
843
+ def output_iosxr(self, replace=False, family=None):
835
844
  """Output the ACL in IOS XR format.
836
845
 
837
846
  :param replace: If set the ACL is preceded by a ``no ipv4 access-list`` line.
847
+ :param family: Accepted for signature compatibility with
848
+ :meth:`~ACL.output_junos`, but ignored -- ``family inet/inet6``
849
+ wrapping is a JunOS-only concept.
838
850
  """
839
851
  if self.name is None:
840
852
  msg = "IOS XR format requires a name"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trigger
3
- Version: 2.3.1
3
+ Version: 2.3.2
4
4
  Summary: Network automation toolkit for managing network devices
5
5
  Author-email: Jathan McCollum <jathan@gmail.com>
6
6
  License-Expression: BSD-3-Clause
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes