Fix FW list command

This provides a fix for issue #48 where the firmware list command failed
when an image needed to be activated. These images now properly appear
in the "Needs Activated" section.

Signed-off-by: Justin Thaler <thalerj@us.ibm.com>
Change-Id: Idab7e417d6a127f890d6b5cb154bc0c3aa48d075
diff --git a/thalerj/openbmctool.py b/thalerj/openbmctool.py
index 6647e1d..dded2c7 100755
--- a/thalerj/openbmctool.py
+++ b/thalerj/openbmctool.py
@@ -2343,12 +2343,15 @@
                 fwActivated = True
             else:
                 fwActivated = False
-            if firmwareDict['data'][key]['Priority'] == 0:
-                firmwareInfoDict['Functional'].update(getFWInventoryAttributes(firmwareDict['data'][key], id))
-            elif firmwareDict['data'][key]['Priority'] >= 0 and fwActivated:
-                firmwareInfoDict['Activated'].update(getFWInventoryAttributes(firmwareDict['data'][key], id))
+            if 'Priority' in firmwareDict['data'][key]:
+                if firmwareDict['data'][key]['Priority'] == 0:
+                    firmwareInfoDict['Functional'].update(getFWInventoryAttributes(firmwareDict['data'][key], id))
+                elif firmwareDict['data'][key]['Priority'] >= 0 and fwActivated:
+                    firmwareInfoDict['Activated'].update(getFWInventoryAttributes(firmwareDict['data'][key], id))
+                else:
+                    firmwareInfoDict['NeedsActivated'].update(getFWInventoryAttributes(firmwareDict['data'][key], id))
             else:
-                firmwareInfoDict['Activated'].update(getFWInventoryAttributes(firmwareDict['data'][key], id))
+                firmwareInfoDict['NeedsActivated'].update(getFWInventoryAttributes(firmwareDict['data'][key], id))
     emptySections = []
     for key in firmwareInfoDict:
         if len(firmwareInfoDict[key])<=0: