Skip to content

Commit

Permalink
fix: fix mysql commit required
Browse files Browse the repository at this point in the history
it adds the commits when the db uses targets_crud.create*

closes #596

Signed-off-by: Kairo de Araujo <[email protected]>
  • Loading branch information
kairoaraujo committed Sep 14, 2024
1 parent 204e0ad commit 8b87c7b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions repository_service_tuf_worker/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ def _add_metadata_hashbin_delegations(
delegated_roles.append(delegated_name)

targets_crud.create_roles(self._db, db_target_roles)
self._db.commit()

def _remove_delegated_role_keys(
self, targets: Metadata[Targets], delegated: DelegatedRole
Expand Down Expand Up @@ -877,6 +878,7 @@ def _add_metadata_delegation(
rolename=role, version=role_metadata.signed.version
)
targets_crud.create_roles(self._db, [db_roles])
self._db.commit()

if persist_targets and len(success) > 0:
self._bump_and_persist(targets, Targets.type)
Expand Down Expand Up @@ -927,6 +929,7 @@ def _delete_metadata_delegation(
self.write_repository_settings(f"{rolename.upper()}_SIGNING", None)
db_role = targets_crud.read_role_by_rolename(self._db, rolename)
targets_crud.update_role_to_deactivated(self._db, db_role)
self._db.commit()
success.append(rolename)

if success:
Expand Down

0 comments on commit 8b87c7b

Please sign in to comment.