Commit 870329f2 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Context component:

- Corrected method UnsetSlice to remove constraints
parent 08e7992a
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@ def upsert_constraints(
) -> bool:
    uuids_to_upsert : Dict[str, int] = dict()
    rules_to_upsert : List[Dict] = list()
    if not is_delete:
    for constraint in constraints:
        constraint_uuid = constraint['constraint_uuid']
        position = uuids_to_upsert.get(constraint_uuid)
@@ -100,11 +99,10 @@ def upsert_constraints(

    # Delete all constraints not in uuids_to_upsert
    delete_affected = False
    if is_delete or len(uuids_to_upsert) > 0:
    if len(uuids_to_upsert) > 0:
        stmt = delete(ConstraintModel)
        if service_uuid is not None: stmt = stmt.where(ConstraintModel.service_uuid == service_uuid)
        if slice_uuid   is not None: stmt = stmt.where(ConstraintModel.slice_uuid   == slice_uuid  )
        if not is_delete:
        stmt = stmt.where(ConstraintModel.constraint_uuid.not_in(set(uuids_to_upsert.keys())))
        #str_stmt = stmt.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True})
        #LOGGER.warning('delete stmt={:s}'.format(str(str_stmt)))