Netem code should fail early when some information is missing (infinite loop on fping)
A colleague did some network emulation based on the docs/tutorials/network_emulation/tuto_svc_htb.py tutorial. However, he forgot the sync_info
call, and this leads to an infinite loop inside netem.validate()
.
Here is what happens in that case:
DEBUG Checking the constraints utils.py:82
DEBUG {'hosts': 'all', 'tasks': [{'name': 'raw', 'raw': 'which fping || apt install -y fping', 'args': {'task': 'Check fping'}}, {'name': 'fping', 'raw': 'fping -C 10 -q -s -e ', 'args': {}}], api.py:785
'gather_facts': False, 'strategy': 'linear'}
We can see that fping
is called without any target. In that case, it waits for targets on its standard input, which hangs indefinitely.
We should fail much earlier if the user forgets to call sync_info
. We should also fix this infinite loop issue with fping (defensive programming).