print execd withen error happens

This commit is contained in:
Cyberes 2024-03-09 17:06:13 -07:00
parent b528868249
commit 798ee6bcd2
1 changed files with 31 additions and 26 deletions

View File

@ -26,6 +26,7 @@ def get_next_elapse(timer_name):
lines = output.split('\n')
for line in lines:
if timer_name in line:
try:
parts = re.search(SYSTEMCTL_TIMERS_RE, line)
datetime_object = None
@ -56,6 +57,10 @@ def get_next_elapse(timer_name):
'activates': parts.group(12)
}
return timer_info, None
except Exception:
print(output)
traceback.print_exc()
sys.exit(nagios.STATE_UNKNOWN)
return None, ValueError('Timer not found')
except subprocess.CalledProcessError as e:
return None, e