Commit d4d15c5d authored by Pablo Armingol's avatar Pablo Armingol
Browse files

Code cleanup and fix bug in context/device.py

parent e5980527
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -124,9 +124,7 @@ class ContextServiceServicerImpl(ContextServiceServicer, ContextPolicyServiceSer

    @safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
    def ListDevices(self, request : Empty, context : grpc.ServicerContext) -> DeviceList:
        devices = device_list_objs(self.db_engine)
        LOGGER.info('DEVICES: {:s}'.format(str(devices)))
        return DeviceList(devices=devices)
        return device_list_objs(self.db_engine)

    @safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
    def GetDevice(self, request : ContextId, context : grpc.ServicerContext) -> Device:
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ def device_get(db_engine : Engine, request : DeviceId) -> Device:
        obj : Optional[DeviceModel] = session.query(DeviceModel)\
            .options(selectinload(DeviceModel.endpoints))\
            .options(selectinload(DeviceModel.config_rules))\
            .options(selectinload(DeviceModel.components))\
            .filter_by(device_uuid=device_uuid).one_or_none()
        return None if obj is None else obj.dump()
    obj = run_transaction(sessionmaker(bind=db_engine), callback)
+1 −1

File changed.

Contains only whitespace changes.