When a YANG file imports another module with a revision date but a newer revision is available in the YANG repository then pyangbind raises a RuntimeError. This is easily reproducible with some trivial YANG files:
(venv)% pyang --plugindir $PYBINDPLUGIN -f pybind -o binding.py example@2023-04-27.yang
Traceback (most recent call last):
File "/Users/anjohnso/Development/cirrus/cirrus-bundles/venv2/bin/pyang", line 580, in <module>
run()
File "/Users/anjohnso/Development/cirrus/cirrus-bundles/venv2/bin/pyang", line 549, in run
emit_obj.emit(ctx, modules, fd)
File "/Users/anjohnso/Development/cirrus/cirrus-bundles/venv2/lib/python3.10/site-packages/pyangbind/plugin/pybind.py", line 222, in emit
build_pybind(ctx, modules, fd)
File "/Users/anjohnso/Development/cirrus/cirrus-bundles/venv2/lib/python3.10/site-packages/pyangbind/plugin/pybind.py", line 406, in build_pybind
build_identities(ctx, defn['identity'])
File "/Users/anjohnso/Development/cirrus/cirrus-bundles/venv2/lib/python3.10/site-packages/pyangbind/plugin/pybind.py", line 446, in build_identities
idstore.build_store_from_definitions(ctx, defnd)
File "/Users/anjohnso/Development/cirrus/cirrus-bundles/venv2/lib/python3.10/site-packages/pyangbind/helpers/identity.py", line 75, in build_store_from_definitions
mod_ref_prefixes = module_import_prefixes(ctx)
File "/Users/anjohnso/Development/cirrus/cirrus-bundles/venv2/lib/python3.10/site-packages/pyangbind/helpers/misc.py", line 24, in module_import_prefixes
for mod in ctx.modules:
RuntimeError: dictionary changed size during iteration
(venv)%
example@2023-04-27.yang
module example {
namespace "urn:example:example";
prefix ex;
import common {
prefix cmn;
revision-date "2023-04-27";
}
revision 2023-04-27;
leaf name {
type cmn:identifier;
}
}
common@2023-04-27.yang
module common {
namespace "urn:example:common";
prefix cmn;
revision 2023-04-27;
typedef identifier {
type string;
}
}
common@2023-04-28.yang
module common {
namespace "urn:example:common";
prefix cmn;
revision 2023-04-28;
revision 2023-04-27;
typedef identifier {
type string;
}
typedef value {
type int16;
}
}
When a YANG file imports another module with a revision date but a newer revision is available in the YANG repository then pyangbind raises a RuntimeError. This is easily reproducible with some trivial YANG files:
example@2023-04-27.yang
common@2023-04-27.yang
common@2023-04-28.yang