Commit 12a16398 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Context component:

- Fixed set/update condition for components
- Removed unneeded log messages
parent 57b355eb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -203,15 +203,15 @@ def device_set(db_engine : Engine, messagebroker : MessageBroker, request : Devi
            stmt = stmt.returning(TopologyDeviceModel.topology_uuid)
            topology_uuids = session.execute(stmt).fetchall()

            LOGGER.warning('RAW topology_uuids={:s}'.format(str(topology_uuids)))
            #LOGGER.warning('RAW topology_uuids={:s}'.format(str(topology_uuids)))
            if len(topology_uuids) > 0:
                topology_uuids = [topology_uuid[0] for topology_uuid in topology_uuids]
                LOGGER.warning('NEW topology_uuids={:s}'.format(str(topology_uuids)))
                #LOGGER.warning('NEW topology_uuids={:s}'.format(str(topology_uuids)))
                query = session.query(TopologyModel)
                query = query.filter(TopologyModel.topology_uuid.in_(topology_uuids))
                device_topologies : List[TopologyModel] = query.all()
                device_topology_ids = [obj.dump_id() for obj in device_topologies]
                LOGGER.warning('device_topology_ids={:s}'.format(str(device_topology_ids)))
                #LOGGER.warning('device_topology_ids={:s}'.format(str(device_topology_ids)))

        updated_components = False
        
@@ -233,7 +233,7 @@ def device_set(db_engine : Engine, messagebroker : MessageBroker, request : Devi
        
        changed_config_rules = upsert_config_rules(session, config_rules, device_uuid=device_uuid)

        return updated or updated_endpoints or changed_config_rules, device_topology_ids
        return updated or updated_endpoints or updated_components or changed_config_rules, device_topology_ids

    updated, device_topology_ids = run_transaction(sessionmaker(bind=db_engine), callback)
    device_id = json_device_id(device_uuid)