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

Add One-Shot Upload #246

Merged
merged 7 commits into from Jul 31, 2019
Merged

Add One-Shot Upload #246

merged 7 commits into from Jul 31, 2019

Conversation

CodeHeeler
Copy link
Contributor

@CodeHeeler CodeHeeler commented Jun 18, 2019

Add one-shot upload with associated docs and tests

One-shot upload with optionally specified repository

fixes #4396
https://pulp.plan.io/issues/4396

@pep8speaks
Copy link

pep8speaks commented Jun 18, 2019

Hello @CodeHeeler! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-07-31 13:50:30 UTC

@CodeHeeler CodeHeeler force-pushed the issue-4396 branch 2 times, most recently from a2bdf0b to e384f06 Compare July 25, 2019 19:26
@CodeHeeler CodeHeeler changed the title WIP Adds One-Shot Upload Add One-Shot Upload Jul 26, 2019
@CodeHeeler CodeHeeler force-pushed the issue-4396 branch 3 times, most recently from 2f74cdb to 40a98d5 Compare July 26, 2019 12:16
'repository': repo['_href']})
task = self.client.get(task_url['task'])
new_repo_version = task['created_resources'][0]
version_content_query = self.client.get(new_repo_version)[
Copy link
Contributor

Choose a reason for hiding this comment

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

If this can be split up differently somehow, that would be awesome. I know it's a nitpick but this is hard to read to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it help to add a comment saying what we're trying to access and that it's deeply nested?

Copy link
Contributor

Choose a reason for hiding this comment

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

How about

version_content_query = self.client.get(
    new_repo_version
)['content_summary']['added']['python.python']['href']

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I like that much better. Honestly, with as large as screens are now, I wish PEP8 would ease the character limit per line a bit more because I spend so much time making things harder to read to get around it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, we've historically used 100 as our limit instead of 80

@@ -0,0 +1 @@
Add one-shot upload and accompanying tests and docs
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to mention tests in the changelog. IMO this should just be stuff we want users to know.


Create content from an artifact
-------------------------------
Add content to a repository
Copy link
Contributor

Choose a reason for hiding this comment

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

s/$/during one-shot upload/

break
if python_models.PythonPackageContent.objects.filter(filename=filename):
raise serializers.ValidationError(detail={'filename': _('This field must be unique')})
# TODO: change from 400 to 409
Copy link
Contributor

Choose a reason for hiding this comment

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

File an issue for this, remove the TODO.

view_name='repositories-detail',
)
file = serializers.FileField(
help_text=_("The python file."),
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be helpful to give a bit more detail here. ie, a whl or whatever-- this sounds like mything.py could be valid.

if filename.endswith(ext):
# Copy file to a temp directory under the user provided filename, we do this
# because pkginfo validates that the filename has a valid extension before
# reading it
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it? I know this came from the RPM plugin which did, I know nothing about pkginfo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, pkginfo does, I verified it in the python shell.

@CodeHeeler CodeHeeler force-pushed the issue-4396 branch 2 times, most recently from f03ff82 to 48e88db Compare July 30, 2019 14:41
Adds one-shot upload feature, optionally specifying a repo
Updates tests and docs accordingly

fixes #4396
https://pulp.plan.io/issues/4396
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants