diff options
author | Andrew Geissler <andrewg@us.ibm.com> | 2016-12-20 10:00:30 -0600 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-01-30 20:53:50 +0000 |
commit | 57eea1bfc3ed9a36c7d6ce09208ed82f1afdd045 (patch) | |
tree | efa26cfb53c83382c85b58dd9c7c301ee60ec232 /pystatemgr/discover_system_state.py | |
parent | 25b9a85074168cf27e111adc3cd5e30b71a14b67 (diff) | |
download | talos-skeleton-57eea1bfc3ed9a36c7d6ce09208ed82f1afdd045.tar.gz talos-skeleton-57eea1bfc3ed9a36c7d6ce09208ed82f1afdd045.zip |
Move pystatemgr over to new host control interfaces
Change-Id: I15b8d0c01164bda44a725b99879eac2b036c69d1
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'pystatemgr/discover_system_state.py')
-rw-r--r-- | pystatemgr/discover_system_state.py | 17 |
1 files changed, 11 insertions, 6 deletions
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 @@ dbus_objects = { '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 @@ def getProperty(bus, objs, key, prop): 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 @@ else: 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 |