Skip to content

str() on a parsed named IOS ACL crashes: output_ios_named() got an unexpected keyword argument 'family' #397

Description

@jathanism

Bug Description

Calling str() on a parsed named IOS ACL raises TypeError: ACL.output_ios_named() got an unexpected keyword argument 'family'. Every named ACL parsed via trigger.acl.parse() is affected whenever it is rendered to a string (including any code path that logs, serializes, or round-trips an ACL).

Steps to Reproduce

from trigger.acl import parse

acl = parse("""ip access-list extended SMOKE
 permit tcp host 10.20.30.40 any eq 22
 permit udp 10.0.0.0 0.255.255.255 any eq 161
 deny ip any any log
""")
print(str(acl))  # boom

Actual Behavior

TypeError: ACL.output_ios_named() got an unexpected keyword argument 'family'

Expected Behavior

The ACL should render in IOS named format.

Root Cause

The call chain breaks like this:

  1. ACL.__str__ (trigger/acl/support.py:696) calls self.output(format=self.format, family=self.family)
  2. ACL.output (line 702) forwards **kwargs to getattr(self, "output_" + format)(*largs, **kwargs)
  3. ACL.output_ios_named(self, replace=False) (line 815) does not accept familyTypeError

Note the inconsistency elsewhere in the same file:

  • ACL.output_junos(self, replace=False, family=None) (line 704) correctly accepts family — JunOS output works.
  • The term-level output_ios_named(self, prefix="", *args, **kwargs) (line 1072) tolerates extra kwargs — only the ACL-level method is broken.

Affected Versions

Confirmed present in v2.3.1 (48cc719) as well as current main — verified by running the repro against the release tag. Not a regression from any recent dependency bump.

Suggested Fix

One-liner: def output_ios_named(self, replace=False, family=None): — accept and ignore family, since IOS named format has no family inet/inet6 wrapping (that's JunOS-only). The test suite currently doesn't exercise str() on a named IOS ACL, so a regression test would be worthwhile.

Environment

  • Python 3.11.14, macOS (Apple Silicon)
  • trigger 2.3.1 and main@79d5362
  • Discovered during a post-dependency-bump smoke test (full test suite otherwise passes 191/191)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions