Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Adds check for duplicate unit key
Browse files Browse the repository at this point in the history
re #1406
  • Loading branch information
dkliban committed Feb 25, 2016
1 parent a902085 commit 2305d8f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/pulp_docker/plugins/importers/sync.py
Expand Up @@ -8,6 +8,8 @@
import logging
import os

from mongoengine import NotUniqueError

from pulp.common.plugins import importer_constants
from pulp.plugins.util import nectar_config, publish_step
from pulp.server.controllers import repository
Expand Down Expand Up @@ -271,7 +273,10 @@ def process_main(self, item):
:type item: pulp.server.db.model.FileContentUnit
"""
item.set_storage_path(item.digest)
item.save_and_import_content(os.path.join(self.get_working_dir(), item.digest))
try:
item.save_and_import_content(os.path.join(self.get_working_dir(), item.digest))
except NotUniqueError:
item = item.__class__.objects.get(**item.unit_key)
repository.associate_single_unit(self.get_repo().repo_obj, item)


Expand Down

0 comments on commit 2305d8f

Please sign in to comment.