Re: [PATCH sandbox] docker: don't assume X-Docker-Token is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 22, 2015 at 09:10:48AM +0200, Cedric Bosdonnat wrote:
> On Mon, 2015-09-21 at 22:12 +0200, Cedric Bosdonnat wrote:
> > On Mon, 2015-09-21 at 15:12 +0100, Daniel P. Berrange wrote:
> > > The Red Hat docker registry (registry.access.redhat.com) does
> > > not set any X-Docker-Token HTTP header in its responses. Change
> > > the code so it only passes around this header if it is actually
> > > present.
> > > 
> > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> > > ---
> > >  libvirt-sandbox/image/sources/DockerSource.py | 12 ++++++++----
> > >  1 file changed, 8 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/libvirt-sandbox/image/sources/DockerSource.py b/libvirt-sandbox/image/sources/DockerSource.py
> > > index f367c8f..78b2a53 100644
> > > --- a/libvirt-sandbox/image/sources/DockerSource.py
> > > +++ b/libvirt-sandbox/image/sources/DockerSource.py
> > > @@ -83,10 +83,14 @@ class DockerSource(Source):
> > >          checksums = {}
> > >          for layer in data:
> > >              pass
> > > +
> > > +        headers = {}
> > > +        if token is not None:
> > > +            headers["Authorization"] = "Token" + token

I accidentally lost the trailing space after the word "Token"

> > >          (data, res) = self._get_json(template,
> > >                                       registryendpoint,
> > >                                       "/v1/repositories" + template.path + "/tags",
> > > -                                     { "Authorization": "Token " + token })
> > > +                                     headers)

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]