peltool to handle blank output

peltool was getting JSONDecodeError on blank output.

Also, made parse_json optional.

Change-Id: Ie03d1ec632ebc9006a40804bcab56155cd643c48
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/pel_utils.py b/lib/pel_utils.py
index cf2eeab..2ad9f52 100644
--- a/lib/pel_utils.py
+++ b/lib/pel_utils.py
@@ -9,7 +9,7 @@
 import json
 
 
-def peltool(option_string, **bsu_options):
+def peltool(option_string, parse_json=True, **bsu_options):
     r"""
     Run peltool on the BMC with the caller's option string and return the result.
 
@@ -30,12 +30,18 @@
         [CreatorID]:                    BMC
 
     Description of argument(s):
-    option_string           A string of options which are to be processed by the peltool command.
-    bsu_options             Options to be passed directly to bmc_execute_command. See its prolog for
-                            details.
+    option_string                   A string of options which are to be processed by the peltool command.
+    parse_json                      Indicates that the raw JSON data should parsed into a list of
+                                    dictionaries.
+    bsu_options                     Options to be passed directly to bmc_execute_command. See its prolog for
+                                    details.
     """
 
     bsu_options = fa.args_to_objects(bsu_options)
     out_buf, stderr, rc = bsu.bmc_execute_command('peltool ' + option_string, **bsu_options)
-    out_buf = json.loads(out_buf)
+    if parse_json:
+        try:
+            return json.loads(out_buf)
+        except json.JSONDecodeError:
+            return {}
     return out_buf