-
-
Save daviddavis/3716ff3a988be8a5d797da136c7b90bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pulpcore/plugin/stages/content_stages.py b/pulpcore/plugin/stages/content_stages.py | |
index 27771c75f..52bd9d823 100644 | |
--- a/pulpcore/plugin/stages/content_stages.py | |
+++ b/pulpcore/plugin/stages/content_stages.py | |
@@ -1,5 +1,6 @@ | |
from collections import defaultdict | |
+from django.core.exceptions import ObjectDoesNotExist | |
from django.db import IntegrityError, transaction | |
from django.db.models import Q | |
@@ -100,10 +101,13 @@ class ContentSaver(Stage): | |
try: | |
with transaction.atomic(): | |
d_content.content.save() | |
- except IntegrityError: | |
- d_content.content = d_content.content.__class__.objects.get( | |
- d_content.content.q() | |
- ) | |
+ except IntegrityError as e: | |
+ try: | |
+ d_content.content = d_content.content.__class__.objects.get( | |
+ d_content.content.q() | |
+ ) | |
+ except ObjectDoesNotExist: | |
+ raise e | |
continue | |
for d_artifact in d_content.d_artifacts: | |
if not d_artifact.artifact._state.adding: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment