[libvirt] [sandbox PATCH 02/11] Fix virt-sandbox-image
Cedric Bosdonnat
cbosdonnat at suse.com
Tue Jul 28 12:43:44 UTC 2015
Hi Eren,
As a fix of the PoC, this commit could introduce the man page for the
new command.
Regards,
--
Cedric
On Thu, 2015-07-23 at 15:57 +0000, Eren Yagdiran wrote:
> Authentication fix for Docker REST API.
> ---
> virt-sandbox-image/virt-sandbox-image.py | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/virt-sandbox-image/virt-sandbox-image.py b/virt-sandbox-image/virt-sandbox-image.py
> index 4da3dde..324e568 100644
> --- a/virt-sandbox-image/virt-sandbox-image.py
> +++ b/virt-sandbox-image/virt-sandbox-image.py
> @@ -1,8 +1,10 @@
> #!/usr/bin/python -Es
> #
> # Authors: Daniel P. Berrange <berrange at redhat.com>
> +# Eren Yagdiran <erenyagdiran at gmail.com>
> #
> # Copyright (C) 2013 Red Hat, Inc.
> +# Copyright (C) 2015 Universitat Politècnica de Catalunya.
> #
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -168,7 +170,7 @@ def download_template(name, server, destdir):
> # or more parents, in a linear stack. Here we are getting the list
> # of layers for the image with the tag we used.
> (data, res) = get_json(registryserver, "/v1/images/" + imagetagid + "/ancestry",
> - { "Cookie": cookie })
> + { "Authorization": "Token " + token })
>
> if data[0] != imagetagid:
> raise ValueError(["Expected first layer id '%s' to match image id '%s'",
> @@ -190,9 +192,9 @@ def download_template(name, server, destdir):
> if not os.path.exists(jsonfile) or not os.path.exists(datafile):
> # The '/json' URL gives us some metadata about the layer
> res = save_data(registryserver, "/v1/images/" + layerid + "/json",
> - { "Cookie": cookie }, jsonfile)
> + { "Authorization": "Token " + token }, jsonfile)
> createdFiles.append(jsonfile)
> - layersize = int(res.info().getheader("x-docker-size"))
> + layersize = int(res.info().getheader("Content-Length"))
>
> datacsum = None
> if layerid in checksums:
> @@ -201,7 +203,7 @@ def download_template(name, server, destdir):
> # and the '/layer' URL is the actual payload, provided
> # as a tar.gz archive
> save_data(registryserver, "/v1/images/" + layerid + "/layer",
> - { "Cookie": cookie }, datafile, datacsum, layersize)
> + { "Authorization": "Token " + token }, datafile, datacsum, layersize)
> createdFiles.append(datafile)
>
> # Strangely the 'json' data for a layer doesn't include
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
More information about the libvir-list
mailing list