summaryrefslogtreecommitdiff
path: root/glanceclient/common
Commit message (Collapse)AuthorAgeFilesLines
* Fix failure to create glance https connection poolHaikel Guemar2015-12-221-3/+4
| | | | | | | | | | | | Due to a typo in an attribute named, an Attribute error is raised causing failure in connection to glance through HTTPS Urllib3 PoolManager class has a connection_pool_kw attribute but not connection_kw Change-Id: Id4d6a5bdcf971d09e80043fd2ab399e208fd931c Closes-Bug: #1479020 (cherry picked from commit c41dcc9f4366429d952cc47853496d58d47b7511)
* Fix client when using no ssl compressionStuart McLaren2015-04-161-0/+7
| | | | | | | | | | | | Since the release of the 0.16.1 client, using the 'no ssl compression' option, whether on the command line, or via the library -- Nova does this by default -- a stack trace was generated. Closes-bug: 1442664 Related-bug: 1357430 Change-Id: I2b8ddcb0a7ae3cfccdfc20d3ba476f3b4f4ec32d (cherry picked from commit c698b4e3227b4767f042e435423fcc307d7f6d5c)
* Merge "Unify using six.moves.range rename everywhere"Jenkins2015-03-041-0/+2
|\
| * Unify using six.moves.range rename everywhereErno Kuvaja2015-02-251-0/+2
| | | | | | | | | | | | | | | | | | Mainly to improve consistency, use range() from six.moves renames across glance. Behaves consistently like py2 xrange() and py3 range(). Change-Id: I7c573a3a9775f454b98d25f2a14f8e9f5f4ac432
* | Merge "https: Prevent leaking sockets for some operations"Jenkins2015-03-041-56/+77
|\ \
| * | https: Prevent leaking sockets for some operationsStuart McLaren2015-02-181-56/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other OpenStack services which instantiate a 'https' glanceclient using ssl_compression=False and insecure=False (eg Nova, Cinder) are leaking sockets due to glanceclient not closing the connection to the Glance server. This could happen for a sub-set of calls, eg 'show', 'delete', 'update'. netstat -nopd would show the sockets would hang around forever: ... 127.0.0.1:9292 ESTABLISHED 9552/python off (0.00/0/0) urllib's ConnectionPool relies on the garbage collector to tear down sockets which are no longer in use. The 'verify_callback' function used to validate SSL certs was holding a reference to the VerifiedHTTPSConnection instance which prevented the sockets being torn down. Change-Id: Idb3e68151c48ed623ab89d05d88ea48465429838 Closes-bug: 1423165
* | | Merge "Register our own ConnectionPool without globals"Jenkins2015-02-261-9/+26
|\ \ \ | |_|/ |/| |
| * | Register our own ConnectionPool without globalsIan Cordasco2015-02-061-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, on systems like Fedora and Debian, it is possible to import urllib3 as well as requests.packages.urllib3. They functionally point to the same code but sys.modules considers them to be separate items. When downstream packagers unvendor urllib3 from requests, they also change all the imports inside of the package. So if the code imports urllib3 from requests.packages.urllib3 and modifies globals in a submodule, that will not be visible to requests since it has been rewritten to use urllib3 (not requests.packages.urllib3). By handling this logic ourselves, we can issue a release until upstream packages and requests can fix this and cut a new release. Change-Id: Ic77ce8a06d9d148a899b4b8695990fca8fdaefc5 Closes-bug: 1396550
* | | Merge "Reduce the set of supported client SSL ciphers"Jenkins2015-02-231-0/+6
|\ \ \
| * | | Reduce the set of supported client SSL ciphersStuart McLaren2014-09-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | python-glanceclient (like, for example, curl) can advertise the default set of supported OpenSSL ciphers in its ClientHello packet. This patches reduces that to a stronger subset. Change-Id: I7c30465e79d8a32f43458cd6253a98fcf067dc38 Closes-bug: #1370283
* | | | Merge "Update HTTPS certificate handling for pep-0476"Jenkins2015-02-191-1/+5
|\ \ \ \ | |_|_|/ |/| | |
| * | | Update HTTPS certificate handling for pep-0476James Page2014-12-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This pep (included in python 2.7.9) changes the behaviour of SSL certificate chain handling to be more py3 like. Include required new exception behaviour in the list of exceptions to translate under py2. https://github.com/python/peps/blob/master/pep-0476.txt Closes-Bug: 1404227 Change-Id: I7da1a13d1ec861a07fd96684d0431508a214a2c8
* | | | Merge "Return 130 for keyboard interrupt"Jenkins2015-02-061-2/+2
|\ \ \ \
| * | | | Return 130 for keyboard interruptRakesh H S2015-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When keyboard interrupt is received by glanceclient, the return code as of now is 1. But since the client was terminated by an keyboard interrupt, the return code should be 130. (http://tldp.org/LDP/abs/html/exitcodes.html) It is useful when people are writing automation test cases and want to validate based on the return code. Change-Id: Ia70116ab6f0708a0ce6eeaed07c1e7a56e68c9f4 Closes-Bug: #1373231
* | | | | Merge "Change oslo.utils to oslo_utils"Jenkins2015-02-063-7/+7
|\ \ \ \ \
| * | | | | Change oslo.utils to oslo_utilsLouis Taylor2015-02-053-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The oslo.utils libraries are moving away from namespace packages. This requires oslo.utils>=1.2.0 bp drop-namespace-packages Change-Id: I803df61e91eabb96329d859aef6bea03530fb84f
* | | | | | Merge "Close streamed requests explicitly"Jenkins2015-02-061-1/+12
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | Close streamed requests explicitlyIan Cordasco2015-01-151-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we don't explicitly close a response after streaming its download, then we can run into HTTPConnectionPool full warnings. It also will hurt performance if we have to continuously create new sockets for new responses. Calling close will return the connection to the pool so it can be reused. Note this is only necessary when streaming a response. If we don't stream it, then requests will return the connection to the pool for us. Change-Id: I803bd4dd0e769c233501d5e5ff07a19705fbe233 Closes-bug: 1341777
* | | | | | Ignore NoneType when encoding headersIan Cordasco2015-02-031-1/+1
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some generated header values may in fact be None. Trying to encode None causes the client to fail with an exception and cannot be worked around by the user. Change-Id: I638b1fba0ef9a07d726445d8c2cdd774140f5b83 Closes-bug: 1415935
* | | | | Remove openstack.common.importutilsLouis Taylor2015-01-282-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This module now lives in oslo.utils, so import it from there. Change-Id: I41fa4897fc820596fb010336044ff4c493017d5a
* | | | | Remove openstack.common.strutilsLouis Taylor2015-01-273-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This module now lives in oslo.utils, so import it from there instead. Co-Authored-By: Ian Cordasco <ian.cordasco@rackspace.com> Change-Id: Ib35dc840992433542490670781badd9529ec8947
* | | | | Handle HTTP byte returns in python 3Jamie Lennox2015-01-141-2/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The returns from requests' response.content is a bytes type. Under python 3 this fails in error handling and string conversion. The response.text variable should be used to treat a response body as a string. Closes-Bug: #1407531 Change-Id: Ifd588b5f6820ef21beb186d88d0b3f1a267695aa
* | | | Merge "Curl statements to include globoff for IPv6 URLs"Jenkins2015-01-081-1/+1
|\ \ \ \
| * | | | Curl statements to include globoff for IPv6 URLssridhargaddam2014-11-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | python-glanceclient displays curl statements for debugging/troubleshooting purposes. For IPv6 URLs, curl requires --globoff to be passed in the arguments. Since glanceclient does not use curl directly, this patch displays the curl commands with globoff option which works for both IPv4 and IPv6 URLs. Fix adapted from python-novaclient Ib7099e8e3bbc15f29bbaa1db37ef21e78a74e7bc Closes-Bug: #1228744 Change-Id: Ie02c4e75ca1ab995102aa55bbff39b2161218b2d
* | | | | Fix Requests breaking download progress barLouis Taylor2015-01-041-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The move to the requests library (dbb242b) broke the progress bar during downloading an image with --progress enabled, due to requests returning a generator, which has no __len__ function. This patch adds an iterable wrapper which provides the length, sourced from Content-Length headers. Closes-Bug: #1384664 Change-Id: I48598a824396bc6e7cba69eb3ce32e7c8f30a18a
* | | | | Fix broken-pipe seen in glance-apiSabari Kumar Murugesan2014-12-221-0/+2
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When file size is an exact multiple of chunk_size, glance client is processing EOF in image-data as a chunk and sends to glance-api. The server treats this as the end of chunked transmission and sends a http response. When the actual last chunk is sent by the 'requests' library, the server sends a 400 response and tracebacks with broken pipe as the client has already closed the socket. Closes-Bug: #1342080 Change-Id: Icdbff838450db1c252ddc919a230a7d3ca16765f
* | | | Support schema types with non-str valueFlavio Percoco2014-12-101-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change I75da1e9309e0f7ef8839dea3ec9c99c58edc5d63 introduced some properties' types which are not string. This broke the `schema_args` utility since lists are not hashable and there was no support for such type values. This patch fixes this issue with a very glance specific strategy in which this values are assumed to have a `null` type and another type - string, integer, etc. The fix ignores `null` options and it takes the first non-null type as the valid one. The patch adds support for enum types that accept `None` Closes-bug: #1401032 Change-Id: I250e8912aca262a56c54ac59bb24f917e5d8cfce
* | | | Don't require version to create Client instanceFlavio Percoco2014-12-091-3/+11
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently require a version to always be passed to discover the client version that should be loaded. However, this information is commonly present in the URL instead. The current behavior forces consumers of the library to keep the required version around and/or to strip it themselves from the URL. This patch relaxes that requirement by making the version a keyword and requesting instead an endpoint to be passed. The patch gives priority to the version in the endpoint and falls back to the keyword if the later is not present. Follow-up patches will improve this code making it interact a bit more with the endpoint's catalog. Closes-bug: #1395714 Change-Id: I4ada9e724ac4709429e502b5a006604ca0453f61
* | | Send `identity_headers` through the wireFlavio Percoco2014-11-251-0/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | Change I09f70eee3e2777f52ce040296015d41649c2586a, introduced a bug where the identity_headers are not added to the request headers anymore causing the former to be completely ignored and useless. This patch fixes that issue by restoring the previous code. A new test has been added to avoid regressions. Closes-bug: #1394965 Change-Id: I1b1633636448398cf3f41217f1d671b43ebd9946
* | Merge "Don't set X-Auth-Token key in http session header if no token provided"Jenkins2014-11-201-1/+3
|\ \
| * | Don't set X-Auth-Token key in http session header if no token providedMatt Riedemann2014-10-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit f980fc549247fa2deb87dfacebc6d8d13ccd45d1 changed how the X-Auth-Token header was scrubbed when logging the request, but effectively made the value required which can lead to an AttributeError if the value for the header is None. The value can be None if you're using Nova but don't have Nova configured with auth_strategy='keystone' (see nova.image.glance._create_glance_client for details). This patch simply checks if the auth_token is set in the http client object and if not, it doesn't set the X-Auth-Token key in the session header. Closes-Bug: #1381295 Change-Id: Ie285d5253df28a9f0f964147a53c99ceaa919c5c
* | | Merge "Don't replace the https handler in the poolmanager"0.14.2Jenkins2014-11-052-3/+16
|\ \ \ | |/ / |/| |
| * | Don't replace the https handler in the poolmanagerFlavio Percoco2014-10-302-3/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to keep the support for `--ssl-nocompression` it was decided to overwrite the https HTTPAdapter in `requests` poolmanager. Although this seemed to work correctly, it was causing some issues when using glanceclient from other services that rely on requests and that were also configured to use TLS. THis patch changes implements a different strategy by using `glance+https` as the scheme to use when `no-compression` is requested. Closes-bug: #1350251 Closes-bug: #1347150 Closes-bug: #1362766 Change-Id: Ib25237ba821ee20a561a163b79402d1375ebed0b
* | Merge "Remove network_utils"Jenkins2014-10-091-2/+2
|\ \
| * | Remove network_utilsOleksii Chuprykov2014-10-031-2/+2
| |/ | | | | | | | | | | Use oslo.utils instead Change-Id: I4830b13794db5570e7dde4a897a7396065028e37
* | Merge "Default to system CA bundle if no CA certificate is provided"Jenkins2014-10-081-2/+3
|\ \ | |/ |/|
| * Default to system CA bundle if no CA certificate is providedRob Crittenden2014-09-021-2/+3
| | | | | | | | | | | | | | | | | | If no CA certificate is provided to be used for validation then fall back to the system-wide CA bundle as presented by python-requests. Change-Id: I05206a868150d4b62b6f1b833310eb9b86b7c4f8 Closes-bug: #1362179
* | Merge "Downgrade log message for http request failures"Jenkins2014-09-171-1/+1
|\ \
| * | Downgrade log message for http request failuresChris Yeoh2014-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Downgrades the log message when an http request fails from error to debug. The logging level changed in the http.py upgrade in I09f70eee3e2777f52ce040296015d41649c2586a which effectively reverted a similar fix commited in I6d0efb53d1e81adf309f7fa580ec5a8073a811c5. We don't want to log at ERROR level because we already have an exception raised and the caller can handle it if wants to. However this error will appear regularly in the Nova logs under normal behavior (say a client specifies an image which does not exist) and there is no way of disabling only the glanceclient error log. This results in a lot of noise in the nova log file. Change-Id: Iec13bff439073a79cb24e9b22fd43603ae4e61b7
* | | Merge "Update how tokens are redacted"Jenkins2014-09-162-6/+15
|\ \ \
| * | | Update how tokens are redactedTravis Tripp2014-09-152-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using SHA-1 to match how Nova and Swift redact their tokens. Was discussed in the below thread: http://lists.openstack.org/pipermail/openstack-dev/2014-September/045802.html Here's what nova went with: https://review.openstack.org/#/c/99511/ swift seem to be following suit: https://review.openstack.org/#/c/99632/ Change-Id: I3045d6d9d2a13770f4022dbbd474b34eb1032f6e Closes-bug: 1329301
* | | | Handle UnicodeDecodeError in log_http_responseMatt Riedemann2014-09-151-1/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | Similar to commit dec9c9f35 and log_curl_request, this ignores decoding errors when logging response headers by passing errors='ignore' to safe_encode. Change-Id: Ic915a7d8334e9473f300c9db670a3a8f5cda8976 Closes-Bug: #1369756
* | | Fix v2 requests to non-bleeding edge serversLakshmi N Sampath2014-09-121-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case where v2 requests are sent to a server which is not running head of tree which includes the v2 metadef code some 404 cases need to be handled to enable standard requests to complete. This patch aslo improves fetching schemas -- they are now only fetched as needed. Change-Id: I8c871f11b909337bd7df19b77e606772dbc634b2 Closes-bug: #1367326
* | | Support for Metadata Definitions Catalog API0.14.0Pawel Koniszewski2014-09-031-2/+12
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | API calls and shell commands added in this patch: - CRUD for metadefs namespaces; - CRUD for metadefs objects; - CRUD for metadefs properites; - CRD for metadefs resource types and resource type associations. Change-Id: I6d15f749038e8fd24fc651f0b314df5be7c673ef Implements: blueprint metadata-schema-catalog-support Co-Authored-By: Facundo Maldonado <facundo.n.maldonado@intel.com> Co-Authored-By: Michal Dulko <michal.dulko@intel.com> Co-Authored-By: Lakshmi N Sampath <lakshmi.sampath@hp.com> Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
* | Catch new urllib3 exception: ProtocolErrorPawel Koniszewski2014-09-031-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new version of requests (2.4.0) has updated underlying urllib3 to version 1.9. Unfortunately urllib3 introduced new exception ProtocolError. Because of that unit tests in glance are failing: ProtocolError: ('Connection aborted.', gaierror(-2, 'Name or service not known')) To solve this problem new urllib3 exception is caught in the same place that the old one was. Unfortunately both exception are still in use so I couldn't remove the old one. Change-Id: I55eef98e734c59b9b627f182768a633b2b701e43 Closes-Bug: #1364893
* | Fix error when logging http response with python 3Louis Taylor2014-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 3 changed the semantics of dict.items() [0], which now returns a iterable 'view' instead of a list of tuples. This has the repercussion that you can no longer check for membership of a key using: key in dict.items() This patch simply replaces that check with a test for the key existing in the dict itself, rather than the items. [0] http://legacy.python.org/dev/peps/pep-3106/ Closes-Bug: 1359880 Change-Id: I7c59b0432725b660c9fa7270cde2e07bf3ea77db
* | Merge "Enable osprofiler interface in glanceclient shell"Jenkins2014-08-201-3/+12
|\ \
| * | Enable osprofiler interface in glanceclient shellZhi Yan Liu2014-08-191-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To help end user uses profiling by glanceclient CLI directly, the change added '--profile <HMAC_KEY>' argument to the shell. This change also fixed a function regression, it was used to pass necessary trace info to glance server via http header: https://github.com/openstack/python-glanceclient/commit/dbb242b776908ca50ed8557ebfe7cfcd879366c8#diff-740dd7d9149f46fe4c01ef0ab7eb3bfbL196 In addition: 1. If client app want to enable profiling feature for glanceclient object, please see: http://paste.openstack.org/show/85722/ 2. Afer adding more trace point into Client object, as fundamental requirement of osprofiler, what we need to notice caller is providing correct messaging notifier in the context code. The relevant change for glance server is ready at: I45a19f5eb5304c2b78a9e12cbc0744941a807304 DocImpact Change-Id: If42b69b2695a5f88536ecbc2c1b3592d9dbd880a Signed-off-by: Zhi Yan Liu <lzy.dev@gmail.com>
* | | Ensure server's SSL cert is validatedStuart McLaren2014-08-192-3/+12
|/ / | | | | | | | | | | | | | | | | | | | | A bug was introduced which meant that the server SSL certificate was not being verified. Here we make sure that it is checked (unless the --insecure flag is used). Helps guard against man-in-the-middle attack. Change-Id: I08f30bf3906b6580c871729311343fa8eefda91b Closes-bug: #1357430
* | Merge "Normalize glanceclient requested service url"Jenkins2014-08-181-3/+4
|\ \