Move pystatemgr over to new host control interfaces
Change-Id: I15b8d0c01164bda44a725b99879eac2b036c69d1
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/pystatemgr/discover_system_state.py b/pystatemgr/discover_system_state.py
index f793314..e52017a 100644
--- a/pystatemgr/discover_system_state.py
+++ b/pystatemgr/discover_system_state.py
@@ -24,10 +24,10 @@
'object_name': '/org/openbmc/sensors/host/BootProgress',
'interface_name': 'org.openbmc.SensorValue'
},
- 'chassis': {
- 'bus_name': 'org.openbmc.control.Chassis',
- 'object_name': '/org/openbmc/control/chassis0',
- 'interface_name': 'org.openbmc.control.Chassis'
+ 'host': {
+ 'bus_name': 'xyz.openbmc_project.State.Host',
+ 'object_name': '/xyz/openbmc_project/state/host0',
+ 'interface_name': 'xyz.openbmc_project.State.Host'
},
'settings': {
'bus_name': 'org.openbmc.settings.Host',
@@ -54,6 +54,11 @@
intf = dbus.Interface(obj, dbus.PROPERTIES_IFACE)
return intf.Get(objs[key]['interface_name'], prop)
+def setProperty(bus, objs, key, prop, prop_value):
+ obj = bus.get_object(
+ objs[key]['bus_name'], objs[key]['object_name'])
+ intf = dbus.Interface(obj, dbus.PROPERTIES_IFACE)
+ return intf.Set(objs[key]['interface_name'], prop, prop_value)
bus = dbus.SystemBus()
pgood = getProperty(bus, dbus_objects, 'power', 'pgood')
@@ -74,11 +79,11 @@
power_policy = settings_intf.Get("org.openbmc.settings.Host",
"power_policy")
print "Last System State:"+system_last_state+"Power Policy:"+power_policy
- chassis_intf = getInterface(bus, dbus_objects, 'chassis')
if (power_policy == "ALWAYS_POWER_ON" or
(power_policy == "RESTORE_LAST_STATE" and
system_last_state == "HOST_POWERED_ON")):
- chassis_intf.powerOn()
+ setProperty(bus, dbus_objects, 'host', 'RequestedHostTransition',
+ 'xyz.openbmc_project.State.Host.Transition.On')
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4