Skip to content

Commit

Permalink
RPM importer needs to handle when unit already exists.
Browse files Browse the repository at this point in the history
closes #1643
  • Loading branch information
jortel committed Feb 9, 2016
1 parent 5c48348 commit ca5c104
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/pulp_rpm/plugins/importers/yum/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from cStringIO import StringIO
from urlparse import urljoin

from mongoengine import NotUniqueError
from nectar.request import DownloadRequest

from pulp.common.plugins import importer_constants
Expand Down Expand Up @@ -601,7 +602,10 @@ def add_rpm_unit(self, metadata_files, unit):
"""
metadata_files.add_repodata(unit)
unit.set_storage_path(unit.filename)
unit.save()
try:
unit.save()
except NotUniqueError:
unit = unit.__class__.objects.filter(**unit.unit_key).first()
repo_controller.associate_single_unit(self.conduit.repo, unit)
self.progress_report['content'].success(unit)
self.conduit.set_progress(self.progress_report)
Expand Down

0 comments on commit ca5c104

Please sign in to comment.