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 sync_mode parameter to endpoint that deploys sync task #159

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

werwty
Copy link
Contributor

@werwty werwty commented May 1, 2018

@werwty
Copy link
Contributor Author

werwty commented May 1, 2018

Just noticed #153
I will rebase this PR after that is merged...

@dralley
Copy link
Contributor

dralley commented May 1, 2018

Use tags : P

@werwty werwty added the 3.0 label May 1, 2018
@werwty
Copy link
Contributor Author

werwty commented May 1, 2018

Looks like the revised changeset will have a sync_mode implementation. I will revise this PR to use that once it is merged, for now leaving as WIP

# Get sync_mode, default to additive
sync_mode = request.data.get('sync_mode', 'additive').lower()

if sync_mode not in ['mirror', 'additive']:
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a ChoiceField to the serializer, which will handle the validation for us. I already added choices as a constant.
https://github.com/pulp/pulp/blob/3.0-dev/common/pulpcore/common/constants.py#L30-L37

@werwty werwty changed the base branch from 3.0-dev to master July 2, 2018 18:14
@werwty werwty force-pushed the task3493 branch 2 times, most recently from 6739b0e to cff7966 Compare September 18, 2018 02:59
@@ -156,13 +156,15 @@ def sync(self, request, pk):
)
serializer.is_valid(raise_exception=True)
repository = serializer.validated_data.get('repository')
mirror = serializer.validated_data.get('mirror', True)
Copy link
Contributor

Choose a reason for hiding this comment

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

This value defaults to True in core, and that serializer is how this option is documented. So I think we shouldn't default here, since our default wouldn't be connected to the schema.
https://github.com/pulp/pulp/blob/cdf6133394d99bbc21a69fae4599d8271d6b344c/pulpcore/pulpcore/app/serializers/repository.py#L142

Copy link
Contributor

@CodeHeeler CodeHeeler left a comment

Choose a reason for hiding this comment

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

Requested change from @asmacdo was made, looks good now.

@werwty
Copy link
Contributor Author

werwty commented Sep 20, 2018

Thanks @CodeHeeler

@werwty werwty merged commit c0bd63b into pulp:master Sep 20, 2018
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.

4 participants