inventory: Move INVENTORY_ROOT to inventory module
Change-Id: Ic68d4a48ff46002858934e0b9c9b1694a2a17a08
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/configs/Barreleye.py b/configs/Barreleye.py
index 52d6906..8a3bbca 100644
--- a/configs/Barreleye.py
+++ b/configs/Barreleye.py
@@ -35,8 +35,6 @@
},
}
-INVENTORY_ROOT = '/org/openbmc/inventory'
-
FRU_INSTANCES = {
'<inventory_root>/system' : { 'fru_type' : 'SYSTEM','is_fru' : True, 'present' : "True" },
'<inventory_root>/system/bios' : { 'fru_type' : 'SYSTEM','is_fru' : True, 'present' : "True" },
diff --git a/configs/Firestone.py b/configs/Firestone.py
index e62a0a8..f525661 100644
--- a/configs/Firestone.py
+++ b/configs/Firestone.py
@@ -28,8 +28,6 @@
},
}
-INVENTORY_ROOT = '/org/openbmc/inventory'
-
FRU_INSTANCES = {
'<inventory_root>/system' : { 'fru_type' : 'SYSTEM','is_fru' : True, 'present' : "True" },
'<inventory_root>/system/bios' : { 'fru_type' : 'SYSTEM','is_fru' : True, 'present' : "True" },
diff --git a/configs/Garrison.py b/configs/Garrison.py
index b5bfd3a..56e3392 100644
--- a/configs/Garrison.py
+++ b/configs/Garrison.py
@@ -28,8 +28,6 @@
},
}
-INVENTORY_ROOT = '/org/openbmc/inventory'
-
FRU_INSTANCES = {
'<inventory_root>/system' : { 'fru_type' : 'SYSTEM','is_fru' : True, 'present' : "True" },
'<inventory_root>/system/bios' : { 'fru_type' : 'SYSTEM','is_fru' : True, 'present' : "True" },
diff --git a/configs/Palmetto.py b/configs/Palmetto.py
index f99d5e2..f1ba970 100644
--- a/configs/Palmetto.py
+++ b/configs/Palmetto.py
@@ -29,8 +29,6 @@
}
}
-INVENTORY_ROOT = '/org/openbmc/inventory'
-
ID_LOOKUP = {
'FRU' : {
0x0d : '<inventory_root>/system/chassis',
diff --git a/configs/Witherspoon.py b/configs/Witherspoon.py
index 4c73efb..debe096 100644
--- a/configs/Witherspoon.py
+++ b/configs/Witherspoon.py
@@ -28,8 +28,6 @@
},
}
-INVENTORY_ROOT = '/org/openbmc/inventory'
-
FRU_INSTANCES = {
'<inventory_root>/system' : { 'fru_type' : 'SYSTEM','is_fru' : True, 'present' : "True" },
'<inventory_root>/system/bios' : { 'fru_type' : 'SYSTEM','is_fru' : True, 'present' : "True" },
diff --git a/pyinventorymgr/inventory_items.py b/pyinventorymgr/inventory_items.py
index 94d8f96..254cd9e 100644
--- a/pyinventorymgr/inventory_items.py
+++ b/pyinventorymgr/inventory_items.py
@@ -99,7 +99,8 @@
pass
for f in FRUS.keys():
- obj_path = f.replace("<inventory_root>", System.INVENTORY_ROOT)
+ import obmc.inventory
+ obj_path = f.replace("<inventory_root>", obmc.inventory.INVENTORY_ROOT)
obj = InventoryItem(bus, obj_path, FRUS[f])
obj_parent.add(obj_path, obj)
diff --git a/pyinventorymgr/obmc/inventory/__init__.py b/pyinventorymgr/obmc/inventory/__init__.py
new file mode 100644
index 0000000..e9a1f83
--- /dev/null
+++ b/pyinventorymgr/obmc/inventory/__init__.py
@@ -0,0 +1 @@
+INVENTORY_ROOT = '/org/openbmc/inventory'
diff --git a/pyinventorymgr/setup.py b/pyinventorymgr/setup.py
index 07e48b4..da85d61 100644
--- a/pyinventorymgr/setup.py
+++ b/pyinventorymgr/setup.py
@@ -2,5 +2,6 @@
setup(name='pyinventorymgr',
version='1.0',
+ packages=['obmc.inventory'],
scripts=['inventory_items.py', 'sync_inventory_items.py'],
)
diff --git a/pyinventorymgr/sync_inventory_items.py b/pyinventorymgr/sync_inventory_items.py
index fff0870..72852a5 100644
--- a/pyinventorymgr/sync_inventory_items.py
+++ b/pyinventorymgr/sync_inventory_items.py
@@ -42,8 +42,9 @@
def get_inv_obj_path(fru_type, fru_name):
obj_path = ''
for f in FRUS.keys():
+ import obmc.inventory
if (FRUS[f]['fru_type'] == fru_type and f.endswith(fru_name)):
- obj_path = f.replace("<inventory_root>", System.INVENTORY_ROOT)
+ obj_path = f.replace("<inventory_root>", obmc.inventory.INVENTORY_ROOT)
return obj_path
diff --git a/pysystemmgr/system_manager.py b/pysystemmgr/system_manager.py
index 9a888cd..93dfcba 100644
--- a/pysystemmgr/system_manager.py
+++ b/pysystemmgr/system_manager.py
@@ -10,6 +10,7 @@
import obmc.enums
import obmc_system_config as System
import obmc.mapper.utils
+import obmc.inventory
DBUS_NAME = 'org.openbmc.managers.System'
OBJ_NAME = '/org/openbmc/managers/System'
@@ -37,7 +38,7 @@
for key in System.ID_LOOKUP[category]:
val = System.ID_LOOKUP[category][key]
new_val = val.replace(
- "<inventory_root>", System.INVENTORY_ROOT)
+ "<inventory_root>", obmc.inventory.INVENTORY_ROOT)
System.ID_LOOKUP[category][key] = new_val
self.SystemStateHandler(System.SYSTEM_STATES[0])