mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
530 stars 343 forks source link

regression in 2.5.1 #774

Closed llhotka closed 2 years ago

llhotka commented 2 years ago

Plugin ietf in release 2.5.1 ends in a stack trace on the YANG module shown at the bottom:

$ pyang --ietf iana-dns-zonemd.yang
Traceback (most recent call last):
  File "/home/lhotka/bin/pyang", line 545, in <module>
    run()
  File "/home/lhotka/bin/pyang", line 414, in run
    ctx_validate_and_prune()
  File "/home/lhotka/bin/pyang", line 410, in ctx_validate_and_prune
    ctx.validate()
  File "/home/lhotka/lib/python/pyang/context.py", line 347, in validate
    statements.validate_module(self, m)
  File "/home/lhotka/lib/python/pyang/statements.py", line 414, in validate_module
    iterate(module, phase)
  File "/home/lhotka/lib/python/pyang/statements.py", line 409, in iterate
    iterate(s, phase)
  File "/home/lhotka/lib/python/pyang/statements.py", line 371, in iterate
    res = f(ctx, stmt)
  File "/home/lhotka/lib/python/pyang/plugins/ietf.py", line 53, in <lambda>
    lambda ctx, s: self.v_chk_description(ctx, s))
  File "/home/lhotka/lib/python/pyang/plugins/ietf.py", line 98, in v_chk_description
    y = int(m.group(1))
AttributeError: 'NoneType' object has no attribute 'group'
module iana-dns-zonemd {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:iana-dns-zonemd";
  prefix dnszmd;

  organization
    "Internet Assigned Numbers Authority (IANA)";

  contact
    "Internet Assigned Numbers Authority

     ICANN
     12025 Waterfront Drive, Suite 300
     Los Angeles, CA 90094

     Tel: +1 424 254 5300

     <mailto:iana@iana.org>";

  description
    "This YANG module translates IANA registries 'ZONEMD Schemes' and
     'ZONEMD Hash Algorithms' to YANG derived types.

     Copyright (c) 2021 IETF Trust. All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject to
     the license terms contained in, the Simplified BSD License set
     forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module was generated from the
     corresponding IANA registries using an XSLT stylesheet from the
     'iana-yang' project (https://github.com/llhotka/iana-yang).";

  reference
    "Domain Name System (DNS) Parameters
     (https://www.iana.org/assignments/dns-parameters/)";

  revision 2021-11-22 {
    description
      "Current revision as of the revision date.";
  }

  /* Typedefs */

  typedef zonemd-scheme-name {
    type enumeration {
      enum SIMPLE {
        value 1;
        description
          "Simple ZONEMD collation";
        reference
          "RFC 8976";
      }
    }
    description
      "This enumeration type defines mnemonic names and corresponding
       numeric values of ZONEMD schemes.";
    reference
      "RFC 8976: Message Digest for DNS Zones";
  }

  typedef zonemd-scheme {
    type union {
      type uint8;
      type zonemd-scheme-name;
    }
    description
      "This type allows reference to a ZONEMD scheme using either the
       assigned mnemonic name or numeric value.";
  }

  typedef zonemd-hash-algorithm-name {
    type enumeration {
      enum SHA384 {
        value 1;
        description
          "SHA-384";
        reference
          "RFC 8976";
      }
      enum SHA512 {
        value 2;
        description
          "SHA-512";
        reference
          "RFC 8976";
      }
    }
    description
      "This enumeration type defines mnemonic names and corresponding
       numeric values of ZONEMD hash algorithms.";
    reference
      "RFC 8976: Message Digest for DNS Zones";
  }

  typedef zonemd-hash-algorithm {
    type union {
      type uint8;
      type zonemd-hash-algorithm-name;
    }
    description
      "This type allows reference to a ZONEMD hash algorithm using
       either the assigned mnemonic name or numeric value.";
  }
}
mbj4668 commented 2 years ago

Can you verfify this fix? Then I'll do a 2.5.2.

llhotka commented 2 years ago

Yes, it now gives an error message but not stack trace.

mbj4668 commented 2 years ago

thanks. I'll create 2.5.2 release.