summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-02-21 10:59:50 +0100
committerGitHub <noreply@github.com>2024-02-21 10:59:50 +0100
commitec87b4c823f88a20e2a72bfd6b7426097dc1574c (patch)
treeefefa0768d7b03f4def456292715267b89dbc326
parentbb2bc7af02a665d5a46c372d338505addff5762b (diff)
parent8357a65b38d78cd1ae9e4dac4f482fa4944de746 (diff)
downloadvyos-1x-ec87b4c823f88a20e2a72bfd6b7426097dc1574c.tar.gz
vyos-1x-ec87b4c823f88a20e2a72bfd6b7426097dc1574c.zip
Merge pull request #3036 from vyos/mergify/bp/sagitta/pr-3032
vyos-event-handler.py: T6048: handling exception when _PID is not found (backport #3032)
-rwxr-xr-xsrc/system/vyos-event-handler.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/system/vyos-event-handler.py b/src/system/vyos-event-handler.py
index 74112ec91..dd2793046 100755
--- a/src/system/vyos-event-handler.py
+++ b/src/system/vyos-event-handler.py
@@ -153,7 +153,12 @@ if __name__ == '__main__':
continue
for entry in data:
message = entry['MESSAGE']
- pid = entry['_PID']
+ pid = -1
+ try:
+ pid = entry['_PID']
+ except Exception as ex:
+ journal.send(f'Unable to extract PID from message entry: {entry}', SYSLOG_IDENTIFIER=my_name)
+ continue
# Skip empty messages and messages from this process
if message and pid != my_pid:
try: