Page MenuHomeVyOS Platform

vyos.vyos: vyos_ping crashes with a traceback when the ping output has no statistics
Open, NormalPublic

Description

vyos.vyos.vyos_ping crashes with a Python traceback instead of a clear failure when the ping output has no statistics line, e.g. ping: <dest>: Name or service not known for an unresolvable host, or an invalid source interface.

In plugins/modules/vyos_ping.py, rate_info stays None when no N packets transmitted line is found and parse_rate() then calls rate_re.match(None) (TypeError). If the line exists but neither regex matches, rate is unbound (UnboundLocalError).

Fix: parse_rate() returns None when nothing matches, and the module fails with msg: Unable to parse ping output and the raw output. Unit test added.

Details

Version
rolling
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)