diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-03-16 11:44:08 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-03-16 11:44:08 +0100 |
commit | b5ede905a4471a8239883c4ec3cc03fba8ec686e (patch) | |
tree | b2b569abb562b9cbdf7792f352e5ba58b9dd9be0 | |
parent | 58abdc976ba9c28b3ab095f999e442afc8e0a6e1 (diff) |
Seems nftrace events produce non-JSON data even with nft -j.
-rwxr-xr-x | naros.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -653,7 +653,13 @@ class NftMonitor: def process(self, process_cb): for line in self._child.stdout: - cmd, val = nft_json_pop(json.loads(line)) + try: + data = json.loads(line) + except json.decoder.JSONDecodeError: + self._logger.error('Error decoding event: %s', line) + continue + + cmd, val = nft_json_pop(data) self._logger.debug('Nft event: %s %s', cmd, val) |