mbj4668 / pyang

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

Problem with emit_depend if revision-date is specified for the import #792

Closed SlavomirMazurPantheon closed 1 year ago

SlavomirMazurPantheon commented 2 years ago

Hello,

YANG Catalog is suffering from a problem with the depend.py plugin. If revision-date is defined for include/import, this revision is not considered in _addprereqs() method.

  import ietf-te {
    prefix "te";
    revision-date "2021-02-20";
  }

If revision specified by revision-date is not the latest revision of the module - None is returned from _getmodule() method https://github.com/mbj4668/pyang/blob/de7a4be61fa699929a31a404e1b696c57737fa5f/pyang/plugins/depend.py#L105 Finally, this results in exception in next _addprereqs() method call (since depend_recurse is set to True) on following line: https://github.com/mbj4668/pyang/blob/de7a4be61fa699929a31a404e1b696c57737fa5f/pyang/plugins/depend.py#L92 Exception:

'NoneType' object has no attribute 'search'"

Regards, Slavomir Mazur