palmetto: remove frus
These are now provided in a json file.
Change-Id: Ib0491399df797a728c7a71118f7d54a07eb3a466
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pyinventorymgr/sync_inventory_items.py b/pyinventorymgr/sync_inventory_items.py
index e11c2e6..6db69cc 100644
--- a/pyinventorymgr/sync_inventory_items.py
+++ b/pyinventorymgr/sync_inventory_items.py
@@ -20,7 +20,7 @@
import dbus
import argparse
import subprocess
-import obmc_system_config as System
+
INV_DBUS_NAME = 'org.openbmc.Inventory'
INV_INTF_NAME = 'org.openbmc.InventoryItem'
@@ -30,7 +30,7 @@
CHS_OBJ_NAME = '/org/openbmc/control/chassis0'
PROP_INTF_NAME = 'org.freedesktop.DBus.Properties'
-FRUS = System.FRU_INSTANCES
+FRUS = {}
# IEEE 802 MAC address mask for locally administered.
# This means the admin has set the MAC and is no longer
@@ -111,6 +111,21 @@
prop_name = opt.p
sync_type = opt.s
+ inventory = os.path.join(
+ sys.prefix, 'share', 'inventory', 'inventory.json')
+ if os.path.exists(inventory):
+ import json
+ with open(inventory, 'r') as f:
+ try:
+ inv = json.load(f)
+ except ValueError:
+ print "Invalid JSON detected in " + inventory
+ else:
+ FRUS = inv
+ else:
+ import obmc_system_config as System
+ FRUS = System.FRU_INSTANCES
+
bus = dbus.SystemBus()
inv_obj_path = get_inv_obj_path(fru_type, fru_name)
inv_obj = bus.get_object(INV_DBUS_NAME, inv_obj_path)