obmcutil: Use freedesktop ObjectManager
The org.openbmc.Object.Enumerate interface is deprecated in favor
of the freedesktop ObjectManager.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pytools/obmcutil b/pytools/obmcutil
index 02c2c2c..6db589e 100644
--- a/pytools/obmcutil
+++ b/pytools/obmcutil
@@ -18,7 +18,17 @@
parent[key] = int(it)
else:
pass
-
+
+
+def merge_interfaces(objs):
+ for op in objs:
+ merged = {}
+ for interface, properties in objs[op].items():
+ merged.update(properties)
+
+ del objs[op]
+ objs[op] = merged
+
def printDict(name,data):
if (isinstance(data, dict)):
@@ -114,14 +124,16 @@
'getinventory' : {
'bus_name' : 'org.openbmc.Inventory',
'object_name' : '/org/openbmc/inventory',
- 'interface_name' : 'org.openbmc.Object.Enumerate',
- 'method' : 'enumerate'
+ 'interface_name' : 'org.freedesktop.DBus.ObjectManager',
+ 'method' : 'GetManagedObjects',
+ 'transform' : merge_interfaces
},
'getsensors' : {
'bus_name' : 'org.openbmc.Sensors',
'object_name' : '/org/openbmc/sensors',
- 'interface_name' : 'org.openbmc.Object.Enumerate',
- 'method' : 'enumerate'
+ 'interface_name' : 'org.freedesktop.DBus.ObjectManager',
+ 'method' : 'GetManagedObjects',
+ 'transform' : merge_interfaces
},
'host' : {
'bus_name' : 'org.openbmc.control.Host',
@@ -179,6 +191,8 @@
data = methd(*sys.argv)
fix_byte(data,None,None)
pydata = json.loads(json.dumps(data))
+ if 'transform' in objinfo:
+ objinfo['transform'](pydata)
printDict("",pydata)
except Exception as e:
print e