summaryrefslogtreecommitdiff
path: root/cinderclient/client.py
Commit message (Collapse)AuthorAgeFilesLines
* Handle auth redirectsSean McGinnis2019-04-181-7/+8
| | | | | | | | | | | | | | Our checking for keystone v2 and v3 was causing v2 tests to go down the v1 code path. Fixing this surfaced a couple of long standing issues with our v2/v3 handling of redirects and getting auth info. This fixes our version identification, fixes extracting redirect location for response headers, and returning the auth_url to calling code. Change-Id: I939ff027bf43e513e338bff1e99ca41fa52637b6 Closes-bug: #1825372 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Fix endpoint identification for api-version querySean McGinnis2018-08-061-1/+7
| | | | | | | | | | | | | | The api-version query is a GET against the root endpoint of cinder. Determining this root endpoint had a flaw with the newer wsgi deployment URLs that would cause it to find the root endpoint of the web server and not cinder. This updates the logic to work with legacy, wsgi, and custom URLs for the Cinder endpoint. Change-Id: Iaeba1f8d50ee8cc9410cc9f638770a56796871fb Closes-bug: #1785594 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Update pylint to work with python 3Sean McGinnis2018-07-231-1/+1
| | | | | | | | | | | | | | | | The pylint job was switched over to run under python 3, but the job is not voting and it was apparently missed that the conversion was causing it to fail. This updates the version of pylint to one that is actually supported by python 3 and makes tweaks to our script to for the minor changes between versions. Single character change to get rid of the more strict py3 regex string escape character format. Change-Id: I93124b62c5ee177815457b32f55f5453fc3d387e Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Let keystoneauth set the microversion headerEric Fried2017-09-281-4/+5
| | | | | | | | | Constructing the Adapter with the default_microversion kwarg causes the Adapter to handle setting the appropriate Openstack-API-Version header. With this change set, SessionClient now uses the api_version kwarg to set default_microversion instead of setting the header explicitly. Change-Id: I5de721fa373f5d3adb42ddb4b5598f19aabfff3b
* Merge "Unsupported 'message' Exception attribute in PY3"3.2.0Jenkins2017-08-291-3/+3
|\
| * Unsupported 'message' Exception attribute in PY3liuyamin2017-08-281-3/+3
| | | | | | | | | | | | | | | | | | | | The 'message' attribute has been deprecated and removed from Python3. Use six.text_type(e) instead of e.message. For more details, please check [1]: [1] https://www.python.org/dev/peps/pep-0352/ Change-Id: Ibd4e7f5fefa6b1dfb6258c5eacfa53cd3485d22c
* | Merge "Enable H306"Jenkins2017-08-221-2/+2
|\ \ | |/ |/|
| * Enable H306Eric Harney2017-08-011-2/+2
| | | | | | | | | | | | | | | | | | Enforce ordering of imports with H306. For tests, this is mostly done by grouping test imports after other cinderclient imports. Change-Id: Ie40fda014d1aedb057e5b4ea1f27f999c84e6373
* | Fix get_highest_client_server_version with Cinder API + uWSGIIvan Kolodyazhny2017-08-041-2/+24
|/ | | | | | | | | | | | | | get_highest_client_server_version should work with any endpoint type: cinder-api with eventlet, uWSGI, etc. This patch is based on python-novaclient patch [1]. In a future, we can deprecate get_highest_client_server_version in flavor of keystoneauth descovery feature. [1] Icba858b496855e2ffd71b35168e8057b28236119 Closes-Bug: #1708188 Change-Id: I9acf6dc84c32b25bfe3254eb0f97248736498d32
* cinderclient might not return version for V2 APIj-griffith2017-07-261-3/+7
| | | | | | | | | | | The get_server_version call in cidnerclient/client.py relies on either finding v 3.x or encountering an exception to revert back to v 2.0. It's not clear that this call will always raise if a non V3 capable Cinder is called, so just to be safe make sure we return a 2.0 response if there's no V3 reported back. Change-Id: I3b5fb895cad4b85d5f4ea286fb33f7dd0929e691 Closes-Bug: #1694729
* Add cinder create --pollChaynika Saikia2017-07-241-0/+3
| | | | | | | | | | | | | Usage: It adds an optional argument --poll to the cinder create command which waits while the creation of the volume is completed and the volume goes to available state. In case there is an error in volume creation, it throws an error message and exits with a non zero status. The error message printed here is the async error message in case it generates one. Depends-On: Ic3ab32b95abd29e995bc071adc11b1e481b32516 Change-Id: I1a4d361d48a44a0daa830491f415be64f2e356e3
* Fix highest version supported by client and serverGorka Eguileor2017-07-191-3/+3
| | | | | | | | | | | | | | | | Current code mistakenly thinks that 3.40 is older than 3.27, because it's treating 3.40 as 3.4, thus returning the wrong maximum supported version by both server and client. It is also returning a 3.40 version as 3.4 because it's returning it as a float. This patch fixes both issues by not using float conversion but using the APIVersion object to do the comparison and by changing returned type to a string so it can be used to instantiate a client. Change-Id: Ica4d718b3de31c31da047f07c5154b242e122596 Closes-Bug: #1705093
* Remove explicit global_request_id from keystoneauth subclassSean Dague2017-06-141-5/+0
| | | | | | | We've embedded global_request_id into keystoneauth1 now, so the special handling for the subclass is not needed. Change-Id: Id45afb9130197887518a8732e046f61396308d58
* support global_request_id in constructorSean Dague2017-05-251-1/+12
| | | | | | | | | | This allows a global_request_id to be created in the constructor which will be passed on all subsequent calls to support cross service request tracking. oslo spec I65de8261746b25d45e105394f4eeb95b9cb3bd42 Change-Id: Ib271ac01c2a4a36e611ae9181ae93305f2318680
* Merge "Remove log translations"Jenkins2017-04-111-3/+2
|\
| * Remove log translationswanghao2017-03-211-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: I92f0729448255cec09263eccea4724c0cf9e8b61 Closes-Bug: #1674550
* | Fix noauth supportIvan Kolodyazhny2017-03-241-8/+2
|/ | | | | | | | | | | | | | | | | | | | | This patch includes several improvements: 1. Use keystoneauth1 plugin mechanism for auth plugins. 2. Implements CinderNoAuthPlugin. 3. Deletes non-working cinderclient.auth_plugin module. 4. Deprecates --bypass-url in flavor of --os-endpoint to be consistent with keystoneauth1 plugins. 5. Deprecates in --os-auth-system in falvor of --os-auth-type to be consistent with keystoneauth1 plugins. Both bypass_url and os_auth_system params are not changed for client objects to not break backward compatibility for Python API. How to use noauth with cinderclient CLI: OS_USER_ID=userid OS_PROJECT_ID=projectis cinder --os-auth-type noauth --os-endpoint=http://localhost:8776/v2 list Change-Id: I3be59a5a39235acbc3334e0a0b797081507a5c88 Closes-Bug: #1657156
* Fix pep8 errorsGorka Eguileor2017-03-151-7/+5
| | | | | | | | | There are some PEP8 errors that are not caught by our gate because of the pep8 package version installed by hacking. This patch fixes E402, W503, and F999 erors from our codebase. Change-Id: I0b86730b1493f161645a87c3daa91ec3d774d3b1
* Remove duplicate get_highest_client_server_versionJohn Griffith2017-03-101-7/+0
| | | | | | | | | | The client method get_highest_client_server_version was so nice, we added it twice. Turns out it's not so nice and one is more than enough. This patch removes the duplicate. Change-Id: Ic5ad022e7cd0322c319bfb412e3113c121848fe0
* Merge "Fix discover_version"Jenkins2017-03-101-1/+8
|\
| * Fix discover_versionscottda2017-03-091-2/+9
| | | | | | | | | | | | | | | | | | | | | | discover_version needs to find the proper module for server_api_version method, and it needs to properly parse a list of versions. Do some refactor to clean things up. Add unit tests. Co-Authored-By: waj334 <justin.wilson@intel.com> Change-Id: I742bc33074cc55fe5f9682b8b97a82573c51183f Closes-Bug: #1632872
* | Handle log message interpolation by the loggerGábor Antal2017-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | According to OpenStack Guideline[1], logged string message should be interpolated by the logger. [1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages Change-Id: Ib5f86d1f0846e292457813c893b73c6999e554a5 Closes-Bug: #1596829
* | static method to get_highest_client_server_versionscottda2017-01-311-0/+7
|/ | | | | | | | This method takes a url for the cinder server endpoint and queries the server for version info. It then returns the min of the server's highest supported version and the cinderclients MAX_VERSION. Change-Id: Ifb3478f1dba660a5d75d243dc2aaf6b421940752
* Merge "static method to get_server_version"Jenkins2017-01-261-0/+25
|\
| * static method to get_server_versionscottda2017-01-261-0/+25
| | | | | | | | | | | | | | This is a static method that takes a url for the cinder endpoint and returns the server's min and max api version as APIVersion objects. Change-Id: I33fa9d0883ad7377c480c9e230412dfa487ccbc9
* | x-openstack-request-id logged twice in logsAbhishek Kekane2017-01-231-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the recent release of keystoneauth1 2.18.0 provision is made to log x-openstack-request-id for session client. Once this new library is synced in openstack projects, the x-openstack-request-id will be logged twice on the console if session client is used. For example, $ cinder --debug list DEBUG:keystoneauth:GET call to volumev2 for http://10.232.48.204:8776/v2/61da9e4b59cf4920acc5e78438f93223/volumes/detail used request id req-dcc22730-021e-468a-8b12-da7d58b573a7 DEBUG:cinderclient.client:GET call to volumev2 for http://10.232.48.204:8776/v2/61da9e4b59cf4920acc5e78438f93223/volumes/detail used request id req-dcc22730-021e-468a-8b12-da7d58b573a7 Above log will be logged twice on the console. Removed logging of x-openstack-request-id in case of SessionClient as it is already logged in keystoneauth1. x-openstack-request-id will only be logged once on console if HTTPClient is used. Depends-On: Id0693a9958d26162b7a2a40173ca28de2d3e4f62 Closes-Bug: #1657351 Change-Id: I0861212a38466d0e65cf3389c7d2757cff86ea0d
* | Merge "Support Keystone V3 with HttpClient"Jenkins2017-01-181-16/+39
|\ \
| * | Support Keystone V3 with HttpClientwangxiyuan2016-12-241-16/+39
| |/ | | | | | | | | | | | | | | The http way doesn't work with keystone v3. This patch update the HttpClient to support it. Closes-bug: #1546280 Change-Id: Iefa1aafb796609aca076ed6ab73d02c92b9198d0
* | modify the wrong comment of the Client classzhangchenchen2017-01-091-1/+1
|/ | | | | | | | | modify comment which is misleading under Client class(/cinderclient/client.py). change the third parameter PROJECT_ID to PROJECT_NAME. Change-Id: I3f39f54a23b3182f2136ae5a14e3c30096f3f2c8 Fixes:bug #1654957
* Mask passwords when logging HTTP req/resp bodiesMatt Riedemann2016-11-091-5/+2
| | | | | | | | | | | | | The very specific 'password' is being masked when logging requests but not when logging response bodies. This change fixes the response logging to mask passwords and also makes the request logging more robust as it was just checking for 'password' but the mask_password method handles much more than that. Change-Id: Id8bf583ecdf60eafb50fd69d6a19180ea97bd92c Closes-Bug: #1640269
* Add v3 user messages with paginationAlex Meade2016-09-011-1/+2
| | | | | | | | | | GET /messages GET /messages/{id} DELETE /message/{id} Partially-Implements: blueprint summarymessage Depends-On: I398cbd02b61f30918a427291d1d3ae00435e0f4c Change-Id: Ic057ab521c048a376d2a6bed513b8eb8118810d1
* Merge "Replace functions 'Dict.get' and 'del' with 'Dict.pop'"Jenkins2016-08-301-2/+1
|\
| * Replace functions 'Dict.get' and 'del' with 'Dict.pop'bhagyashris2016-08-291-2/+1
| | | | | | | | | | | | | | | | | | | | Refactoring code: Making dicts to use single instruction: pop() rather than two instructions: get() and del, giving the codes a format that carries through. TrivialFix Change-Id: Ie404888ccf257978e0ac491165926dfde9a3e6d6
* | Fix NoneType error for cinderclient v1Rui Chen2016-08-251-1/+1
|/ | | | | | | | | | Request-id log is recorded in SessionClient.request() method, but None is used as logger, that causes all the v1 commands to be broken. This patch fixes the issue and updates the related unit tests. Change-Id: I46b973f2baca8d7402a39e0d15dbd8da38f4e590 Closes-Bug: #1616070
* Merge "Switch to keystoneauth"Jenkins2016-07-261-8/+11
|\
| * Switch to keystoneauthSteve Martinelli2016-07-231-8/+11
| | | | | | | | | | | | | | | | | | | | | | move cinderclient to keystoneauth as keystoneclient's auth session, plugins and adapter code has been deprecated. Co-Authored-By: Paulo Ewerton <pauloewerton@lsd.ufcg.edu.br> Co-Authored-By: Sean McGinnis <sean.mcginnis@gmail.com> Co-Authored-By: Jamie Lennox <jamielennox@gmail.com> Change-Id: Id4bf0e2088e8ad99e83cd4f9b8549c2aca1f65a2
* | Merge "Make sure --bypass-url honored if specified"Jenkins2016-07-261-2/+2
|\ \ | |/ |/|
| * Make sure --bypass-url honored if specifiedQiu Yu2016-06-061-2/+2
| | | | | | | | | | | | | | | | Currently SessionClient ignored --bypass-url which is only used with HTTPClient. This change force to use HTTPClient if bypass-url specified. Change-Id: I03d1eec8cfda81efce409399b8d6ca91b779840b Closes-Bug: #1467577
* | Add api-version to get server versionsscottda2016-07-111-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Mitaka Cinder added an API to return Versions from the base endpoint URL: http://<url>:8776/ This patch exposes that API for /v3 endpoint microversions 3.0 and above with the command: cinder api-version Implements: blueprint add-get-server-versions Change-Id: Ieb1a56b28188ec17946fe5564b28c165833ffc24
* | Cinder client should retry with Retry-After valueYuriy Nesenenko2016-07-061-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a request fails but the response contains a "Retry-After", the cinder client should wait the amount of time and then retry. Cinder client should report a warning to user and continue with retry, so that user can cancel the operation if not interested in retry. The value in "Retry-After" header will be in seconds or GMT value, client should handle both the cases. How many times client should retry will be controlled by user through "--retries" argument to cinder api example, $ cinder --retries 3 availability-zone-list If request was not sucessful within the retries, client should raise the exception. Change-Id: I99af957bfbbe3a202b148dc2fcafdd20b5d7cda0 Partial-Bug: #1263069
* | Log request-id for each api callAbhishek Kekane2016-06-281-2/+24
|/ | | | | | | | | | Added new private method to log request-id of each api call for both SessionClient and HTTPClient. Already available ks_logger and client_logger will be used for SessionClient and HTTPClient respectively. Change-Id: I679c57b96071ecd9bcd1ab2ed50692195586ca52 Implements: blueprint log-request-id
* Don't enable lazy translation when loading client1.8.0Victor Stinner2016-05-301-4/+0
| | | | | | | | | | | | | | The change I9c8db9487b554b637a41620c858a7e7abf802879 introduced a regression in nova and trove. Importing cinderclient.client now calls _i18n.enable_lazy() which calls oslo_i18n.enable_lazy(). It's wrong to modify a global variable (oslo_i18n._lazy.USE_LAZY) when a module is imported. This change removes the call to _i18n.enable_lazy() from client.py. Closes-Bug: #1587071 Related-Bug: 1586976 Change-Id: I1512b86815e7248fa226c6969124ddc654145562
* Remove Python 2.5 compat shimEric Harney2016-04-211-5/+0
| | | | | | We don't support or test with Python 2.5. Change-Id: Id29f0cee786205cc751d2d5bc031b3c105ae6aaa
* Support api-microversionsscottda2016-04-191-4/+56
| | | | | | | | | Changes to cinderclient to use microversions. Implements: blueprint api-microversion-support-for-cinderclient api-microversion-support-for-cinderclient Change-Id: I840a1162b88e8ff36fa3fc4e1d6b9317104df3e0
* Merge "Add /v3 endpoint support for cinderclient"Jenkins2016-04-191-2/+3
|\
| * Add /v3 endpoint support for cinderclientscottda2016-04-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add support for Cinder API /v3 endpoint. A couple of unit tests for /v3 endpoint were added to v3/test_shell.py to ensure that the v3 shell works, and to also test that modules work with: from cinderclient.v2.availability_zones import * syntax. Change-Id: I6ae0ada221bebb4ab1850d9c99b10fcbb585201f Implements: https://blueprints.launchpad.net/python-cinderclient/+spec/add-v3-endpoint-support
* | Merge "Change extension module naming to a shorter one"Jenkins2016-04-191-1/+1
|\ \ | |/ |/|
| * Change extension module naming to a shorter oneIvan Kolodyazhny2016-01-131-1/+1
| | | | | | | | | | | | | | This patch changes extension suffix from 'python_cinderclient_ext' to 'cinderclient_ext' to get more shorter module names. Change-Id: Id78e05646d2bc4fda758710eb630dca5eefa457f
* | Merge "Graduate to oslo.i18n and cleanup incubator usage"Jenkins2016-04-121-3/+6
|\ \
| * | Graduate to oslo.i18n and cleanup incubator usageRonald Bradford2016-03-241-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Graduate from Oslo Incubator to oslo.i18n library. Cleanup of unused Oslo Incubator utils. Added optional enable_lazy() usage. Implements: blueprint graduate-oslo-i18n [1] https://blueprints.launchpad.net/oslo-incubator/+spec/graduate-oslo-i18n Change-Id: I9c8db9487b554b637a41620c858a7e7abf802879