summaryrefslogtreecommitdiff
path: root/glanceclient/exc.py
Commit message (Collapse)AuthorAgeFilesLines
* Replace old httpclient with requestsAmalaBasha2014-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This review implements blueprint python-request and replaces the old http client implementation in favor of a new one based on python-requests. Major changes: * raw_request and json_request removed since everything is now being handled by the same method "_request" * New methods that match HTTP's methods were added: - get - put - post - head - patch - delete * Content-Type is now being "inferred" based on the data being sent: - if it is file-like object it chunks the request - if it is a python type not instance of basestring then it'll try to serialize it to json - Every other case will keep the incoming content-type and will send the data as is. * Glanceclient's HTTPSConnection implementation will be used if no-compression flag is set to True. Co-Author: Flavio Percoco<flaper87@gmail.com> Change-Id: I09f70eee3e2777f52ce040296015d41649c2586a
* Replace OpenStack LLC with OpenStack FoundationZhiQiang Fan2013-09-201-1/+1
| | | | | Change-Id: I38dcbcf1a6c8efe540fcf5f29e782cb3826e583d Fixes-Bug: #1214176
* Start using Pyflakes and HackingDirk Mueller2013-06-221-12/+12
| | | | | | | | | | Instead of globally ignoring pyflakes and hacking warnings, only blacklist those that trigger very frequently so far, in order to clean them up in followup commits. Fix and start gating on the rest already. Change-Id: Ied7c7250061e3bf379e8286e8ce3b9e4af817faf
* Add details to stdout error message.Ken'ichi Ohmichi2013-01-011-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current glance command does not show the details of error message. For example, the glance command shows HTTPBadRequest only if some necessary parameter is not specified. $ glance image-create --file root-fs.img --name cirros-0.3.0-x86_64-uec Request returned failure status. HTTPBadRequest (HTTP 400) $ By only the above message, it is not easy that a user understand the reason of an error. glance-api server returns the details of reason, but glance command does not show it. This patch adds details, which is gotten from glance-api server, to error message. And a user will be able to understand the reason of a error like the following: $ glance image-create --file root-fs.img --name cirros-0.3.0-x86_64-uec Request returned failure status. 400 Bad Request Invalid disk format 'None' for image. (HTTP 400) $ Fixes bug 1094917 Change-Id: I49192c3ebbc8a70b63dcfcede9fd13f1688388cf
* Verify that host matches certificateStuart McLaren2012-11-201-0/+4
| | | | | | | | | | When using https verify that the Common Name (CN) or the Subject Alternative Name listed in the server's certificate match the host we are connected to. Addresses LP bug 1079692. Change-Id: I24ea1511a2cbdb7c34ce72ac704d7b5e7d57cec2
* Implement blueprint ssl-connect-reworkStuart McLaren2012-10-081-0/+4
| | | | | | | | | | | | | | | | | Use pyOpenSSL for HTTPS connections. This allows: * Neater loading of system CA files * Optional disabling of SSL compression The performance gain from disabling SSL compression is significant in cases where the image being uploaded/downloaded is in an already compressed format (eg qcow2). Related to bp ssl-connect-rework. Change-Id: I0568b6c95c5fc7b8eafdbd0284e24c453660a55a
* Catches HTTP 300 while printing responsesisethi2012-09-101-0/+10
| | | | | | | | | | 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
* Handle communication failures cleanlyBrian Waldon2012-08-101-5/+16
| | | | | | | | | | 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
* Refactor HTTP-related exceptionsBrian Waldon2012-08-081-88/+91
| | | | | | | | | | | | | | | | | * Refactor helper function that builds the map of http status codes to local http exceptions - now we don't have to explicitly list every single exception name * Add several exceptions to represent http status codes that were not previously represented * Improve consistency of exceptions naming by prepending 'HTTP' to necessary exception names * Use HTTPException instead of ClientException * Deprecate old http exceptions (those that aren't prefixed with HTTP) * Deprecate ClientException * Deprecate unused NoTokenLookupException and EndpointNotFound * Add test module to spot-check the from_response helper Change-Id: Ibc7fef9e2a5b24bd001d183d377901f302d650a9
* Simplify v2 schema lookupBrian Waldon2012-08-081-5/+0
| | | | | | | | We don't need to look at the container of available schemas in order to get the one we want. Remove glanceclient.exc.SchemaNotFound as it can no longer be raised. Change-Id: Ib49ad58c4fdfc9bc9f535115674d92040a97db65
* Add missing copyright headersBrian Waldon2012-08-021-0/+15
| | | | | | | | | A few files were missing copyright headers: * glanceclient/common/http.py * glanceclient/v1/__init__.py * glanceclient/exc.py Change-Id: Ibbd53cd49f9367994de66a30601b3aefe1a8d6ee
* Add exceptions for 500 and 503 HTTP status codesBrian Waldon2012-07-291-2/+19
| | | | | | | | | Add glance.exc.InternalServerError and .ServiceUnavailable to represent HTTP statuses 500 and 503. Users will definitely see these from Glance, so let's be nice and map them to handy exception classes. Change-Id: I8e8fcda532455793ea4d0f08a23f7c92b68c186c
* Replace httplib2 with httplib as http driverBrian Waldon2012-07-231-24/+8
| | | | | | | | * 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
* Establish the supported importable interfaceBrian Waldon2012-07-131-0/+131
* 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