Skip to content

Conversation

@mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Jan 7, 2017

Call HasBlob in dockerImageDestination.PutBlob so that we only have one copy of the code.

Note that the first commit of this modifies HasBlob to fail on unexpected HTTP response statuses, instead of returning “blob not present”; this was modified in #63 but there hasn’t been an explicit explianation why, and right now, with the code duplicated, PutBlob is using its own implementation which aborts on such statuses, so AFAICT the change was either unintentional or ineffective. @nalind ?

@mtrmac
Copy link
Collaborator Author

mtrmac commented Jan 31, 2017

@runcom PTAL

@runcom
Copy link
Member

runcom commented Jan 31, 2017

👍 sounds good to me, @nalind?

Approved with PullApprove

@mtrmac mtrmac force-pushed the docker-HasBlob branch 3 times, most recently from 10c34b0 to ce8c214 Compare February 6, 2017 20:42
mtrmac added 2 commits March 2, 2017 20:38
The code originates in PutBlob, where unexpected HTTP statuses made us
abort and not even try to upload; so, it seems that HasBlob should
similarly return an error (possibly causing the caller to abort)
similarly.  The caller can of course still decide to ignore unexpected
errors, but this is not an “all is well, blob has not been uploaded”
situation (or at least we have been happy enough not to treat it as such a
situation in PutBlob so far).

Signed-off-by: Miloslav Trmač <[email protected]>
… so that we only have one copy of the code.

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac
Copy link
Collaborator Author

mtrmac commented Mar 2, 2017

👍

No response from @nalind in a month, merging.

Approved with PullApprove

@mtrmac mtrmac merged commit 7805fe0 into containers:master Mar 2, 2017
@mtrmac mtrmac deleted the docker-HasBlob branch March 2, 2017 20:04
lucab added a commit to lucab/image that referenced this pull request Mar 28, 2017
After PR containers#202, PutBlob() now goes through an initial HasBlob()
which may require authentication in order to perform the check;
in such case a push-only scoped token will fail with:
```
service="registry.docker.io",scope="repository:<name>:pull",error="insufficient_scope"
```

This fixes the above case by changing the scope of the token
requested for uploads, allowing pull+push.

Signed-off-by: Luca Bruno <[email protected]>
lucab added a commit to lucab/image that referenced this pull request Mar 28, 2017
After PR containers#202, PutBlob() now goes through an initial HasBlob()
which may require authentication in order to perform the check;
in such case a push-only scoped token will fail with:
```
service="registry.docker.io",scope="repository:<name>:pull",error="insufficient_scope"
```

This fixes the above case by changing the scope of the token
requested for uploads, allowing pull+push.

Signed-off-by: Luca Bruno <[email protected]>
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.

2 participants