Handle when no errors are on system
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/openbmc-events b/openbmc-events
index 1a3f93d..41bbbef 100755
--- a/openbmc-events
+++ b/openbmc-events
@@ -5,6 +5,7 @@
import json
import urllib3
+from warnings import catch_warnings
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
@@ -26,6 +27,9 @@
r = self.session.get(self.url + 'xyz/openbmc_project/logging/entry/',
verify=False)
j = r.json()
+ if j['message'] == '404 Not Found':
+ print "No error logs on system\n"
+ return
if j['status'] != 'ok':
raise Exception("Failed to query entries: \n" + r.text)
@@ -82,8 +86,12 @@
def do_list_events(args):
s = BMC(server=args.server)
- for e in s.list_events():
- print(e)
+ try:
+ for e in s.list_events():
+ print(e)
+ except:
+ # ignore if we get nothing back
+ return;
def do_view_event(args):