Ensure namespaced writer commit has correct namespace

The namespaced writer Commit method must always have a
namespace in the context as checked by the removeIngestLease
function, resulting in a panic when not provided.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan 2019-05-21 11:08:55 -07:00
parent bcb6c8db47
commit 41b7b0e0dc
No known key found for this signature in database
GPG Key ID: F58C5D0A4405ACDB

View File

@ -567,6 +567,8 @@ func (nw *namespacedWriter) createAndCopy(ctx context.Context, desc ocispec.Desc
} }
func (nw *namespacedWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error { func (nw *namespacedWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error {
ctx = namespaces.WithNamespace(ctx, nw.namespace)
nw.l.RLock() nw.l.RLock()
defer nw.l.RUnlock() defer nw.l.RUnlock()