Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds check for duplicate unit key #66

Merged
merged 1 commit into from
Feb 25, 2016
Merged

Conversation

dkliban
Copy link
Member

@dkliban dkliban commented Feb 24, 2016

re #1406

try:
package.save_and_import_content(file_path)
except NotUniqueError:
package = package.__class__.objects.filter(**package.unit_key).first()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use .get() instead of .filter().first() which will get you one object. However, get() does raise an Exception if nothing matches.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the uploaded file? Where will it go? Will it get garbage collected by the task working dir mechanism? I'll assume yes, just want to make sure.

@bowlofeggs
Copy link

I filed an issue about the Jenkins failure. It's not due to your change:

https://pulp.plan.io/issues/1719

Travis has been failing for a long time. It might be worth just turning off.

@bowlofeggs bowlofeggs added bug Something isn't working LGTM labels Feb 25, 2016
@bowlofeggs
Copy link

Before you merge, be sure to add a unit test for this. pulp_python used to have 100% coverage. Not sure it still does, but it might be good to strive for. Alternatively, add a pulp-smash test.

@bowlofeggs
Copy link

To reiterate, on your other PRs I suggested filing an issue to test later was fine. However, as this project has historically had 100% test coverage I think we should strive to maintain it. That's my opinion though. If others disagree I can go with a vote on it.

@bowlofeggs
Copy link

I just checked and the master branch currently does have 100% coverage, so we should definitely maintain it.

dkliban added a commit that referenced this pull request Feb 25, 2016
Adds check for duplicate unit key
@dkliban dkliban merged commit af63c21 into pulp:master Feb 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants