If glance v1 api is not enabled, and a request is made to it,
it gives a KeyError. This patch catches the 300 error and
displays error message.
Fixes bug 1046607
Change-Id: I0009a5deca3b5dd5ccaeaea90feee21274bfe090
In http.py the exception raised in get_connection
should be httplib.InvalidURL rather than httplib.InvalidUrl.
Fix for bug 1048698.
Change-Id: I7f18321fe7d8669b3b95bf823273ee8ae6961661
When SSL is being used and the --ca-file option is
not specified use an available system CA file to
verify the server's certificate.
Change-Id: Id5c9fda6fd9bd05cde3c2a9160a6e72cef086a44
Expand exceptions to cover more failures cases. This adds
CommunicationFailure to represent any failures while attempting
to communicate with the remote endpoint. This also adds a new base
exception class BaseException which should be used for all non-HTTP
related failures.
Change-Id: Ie3e1d45c520d816a3f491a85fde94a6c4edf295e
This allows a user to pass a cert and a key to use in HTTPS
connections. The flags --cert-file and --key-file are added
to the CLI.
Addiionally, update the debug curl logging to print --cacert and
-k when ca_file and insecure are set.
Related to bp glance-client-parity.
Change-Id: Ibaea51419a903afb7939a6b5b848f7a6667893bf
This adds support for validation of ssl certs returned by remote
servers over SSL. The --ca-file param represents the CA cert used
to sign the remote server's cert. Use --insecure if the remote
server is using a self-signed cert or you don't have the CA cert.
Related to bp glance-client-parity
Change-Id: I45253a6e2d88da599addfcc464571e62ae920166
A few files were missing copyright headers:
* glanceclient/common/http.py
* glanceclient/v1/__init__.py
* glanceclient/exc.py
Change-Id: Ibbd53cd49f9367994de66a30601b3aefe1a8d6ee
Using the --debug flag or the GLANCECLIENT_DEBUG env var, a user will
see http requests and responses in great detail. Requests are formed
into proper curl commands while responses are printed just as they would
as if the curl request provided were executed. Response bodies will not
be printed if they are application/octet-stream.
Change-Id: I9c9c5d6ec9f481091c944e596d073da3739795b6
The --debug argument has been ignored since httplib2 was replaced
with httplib. This re-enables the --debug flag as an equivalent
to the env var GLANCECLIENT_DEBUG.
Fixes bug 1030700
Change-Id: Ib653049eea2f18c4cc2f8f8aac7884245afd0f04
* This allows us to send truly chunked responses to users
* Handle bad connection url schemes with a new InvalidEndpoint exception
* Fixes bug 1023240
Change-Id: I34500987f51d4e0c6e1f89ecf93853de3fcbb1c3
* Consumers of this client should not depend on being able to import
any module other than glanceclient and glanceclient
* The only attributs of the glanceclient module are Client
and __version__
* The attributes of the glanceclient.exc modules have yet to be
locked down
* glanceclient.common.exceptions was replaced with a placeholder
module until consumers of it are updated
Change-Id: Iea9648cd06906d65764987c1f2ee5a88ebeee748
This is establishing the API for a future optimization. We want to
be able to offer true socket-level caching, but can't do that with
httplib2 right now. For now, we will just fake the optimization
by returning an iterator over the image body, which happens to already
be fully loaded into a string.
Change-Id: I2d36e3cdd45b26d7c7c27ba050bf6a4b5765df6c
Rather than depend on magic, I would prefer that we explicitly call
two different request methods: json_request and raw_request. The
former will encode/decode request bodies to and from JSON, while
the latter will not.
Change-Id: I6a429a5975993f71df85df55f11c5d51c050c289