try: tar = tarfile.open(outfile, "r") tar.extractall(UPDATE_PATH, members=doExtract(tar, copy_files)) tar.close() if (self.Get(DBUS_NAME, "clear_persistent_files") == False): print "Removing persistent files" os.unlink(UPDATE_PATH + "/whitelist") if (self.Get(DBUS_NAME, "preserve_network_settings") == True): print "Preserving network settings" shutil.copy2("/dev/mtd2", UPDATE_PATH + "image-u-boot-env") except Exception as e: print e self.Set(DBUS_NAME, "status", "Update Error") self.Set(DBUS_NAME, "status", "Update Success. Please reboot.") if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) bus = Openbmc.getDBus() name = dbus.service.BusName(DBUS_NAME, bus) obj = BmcFlashControl(bus, OBJ_NAME) mainloop = gobject.MainLoop() print "Running Bmc Flash Control" mainloop.run()
self.Set(IFACE_NAME,"floor",250) self.Set(IFACE_NAME,"ceiling",255) self.fan_intf = [] ## create interface proxies to all fans for fan in FAN_OBJS: print "Initializing fan: "+fan obj = bus.get_object(FAN_BUS,fan) self.fan_intf.append(dbus.Interface(obj,FAN_IFACE)) self.InterfacesAdded(name,self.properties) @dbus.service.method(DBUS_NAME, in_signature='', out_signature='') def setMax(self): print "Setting fans to max" for intf in self.fan_intf: intf.setValue(dbus.UInt32(255)) if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) bus = Openbmc.getDBus() name = dbus.service.BusName(DBUS_NAME,bus) fan_control = FanControl(bus,OBJ_PATH) mainloop = gobject.MainLoop() print "Starting fan control" fan_control.setMax() mainloop.run()