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

Have get_resource() use pk and only pk if pk is provided #3468

Merged
merged 1 commit into from Apr 23, 2018
Merged

Have get_resource() use pk and only pk if pk is provided #3468

merged 1 commit into from Apr 23, 2018

Conversation

daviddavis
Copy link
Contributor

We should ignore other kwargs since pk should uniquely identify the
resource. The problem we were experiencing in pulp_ansible is that we
had a pk and a role_pk. The conversion from role_pk to role_id only
happens inside the else block and so we're getting a FieldError because
role_pk doesn't exist on the model. Instead, I think we should just use
the pk kwarg and ignore the rest.

@daviddavis
Copy link
Contributor Author

Another alternative fix would be to move this logic outside of the else:

https://github.com/pulp/pulp/pull/3468/files#diff-ae7f375b1b9eaee42aecdf250679cd6eL137

We should ignore other kwargs since pk should uniquely identify the
resource. The problem we were experiencing in pulp_ansible is that we
had a pk and a role_pk. The conversion from role_pk to role_id only
happens inside the else block and so we're getting a FieldError because
role_pk doesn't exist on the model. Instead, I think we should just use
the pk kwarg and ignore the rest.
@codecov
Copy link

codecov bot commented Apr 23, 2018

Codecov Report

Merging #3468 into 3.0-dev will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           3.0-dev    #3468   +/-   ##
========================================
  Coverage    57.03%   57.03%           
========================================
  Files           59       59           
  Lines         2509     2509           
========================================
  Hits          1431     1431           
  Misses        1078     1078
Impacted Files Coverage Δ
pulpcore/pulpcore/app/viewsets/base.py 77.09% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae19f2c...8f6658b. Read the comment docs.

@bmbouter bmbouter merged commit 17a0a1b into pulp:3.0-dev Apr 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants