sensor_mgr: allow missing config file
Allow sensor_mgr to at least start without a board config
file.
Change-Id: I30d7cc7ec10f6d398236245e28192a20ae4f5125
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pysensormgr/sensor_manager2.py b/pysensormgr/sensor_manager2.py
index c1a3204..9a4bc08 100644
--- a/pysensormgr/sensor_manager2.py
+++ b/pysensormgr/sensor_manager2.py
@@ -6,7 +6,12 @@
import dbus.mainloop.glib
import obmc.sensors
from obmc.dbuslib.bindings import DbusProperties, DbusObjectManager, get_dbus
-import obmc_system_config as System
+
+try:
+ import obmc_system_config as System
+ has_system = True
+except ImportError:
+ has_system = False
DBUS_NAME = 'org.openbmc.Sensors'
OBJ_PATH = '/org/openbmc/sensors'
@@ -46,13 +51,14 @@
## instantiate non-polling sensors
## these don't need to be in seperate process
- for (id, the_sensor) in System.MISC_SENSORS.items():
- sensor_class = the_sensor['class']
- obj_path = System.ID_LOOKUP['SENSOR'][id]
- sensor_obj = getattr(obmc.sensors, sensor_class)(bus, obj_path)
- if 'os_path' in the_sensor:
- sensor_obj.sysfs_attr = the_sensor['os_path']
- root_sensor.add(obj_path, sensor_obj)
+ if has_system:
+ for (id, the_sensor) in System.MISC_SENSORS.items():
+ sensor_class = the_sensor['class']
+ obj_path = System.ID_LOOKUP['SENSOR'][id]
+ sensor_obj = getattr(obmc.sensors, sensor_class)(bus, obj_path)
+ if 'os_path' in the_sensor:
+ sensor_obj.sysfs_attr = the_sensor['os_path']
+ root_sensor.add(obj_path, sensor_obj)
mainloop = gobject.MainLoop()