summaryrefslogtreecommitdiff
path: root/cinderclient/shell.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove deprecated CLI optionsSean McGinnis2018-07-231-28/+0
| | | | | | | | | | | | The following options were deprecated in Queens or Pike and are now being removed: --endpoint-type --bypass-url --os-auth-system Change-Id: I3b951cc4eb3adff23f3d2cbe674971816261ef56 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Allow --help for specific commandsEric Harney2018-04-101-0/+6
| | | | | | | | | | | | This makes calls such as: $ cinder list --help work as expected, equivalent to: $ cinder help list rather than just printing the full help message. Change-Id: I038eeeea554f0bb5dd170f503eaec570441520b3
* fix a typo in documentationmelissaml2018-03-231-1/+1
| | | | Change-Id: Icb6c9808829c6088f6ae2408718bcb03ddc7b53a
* Migrate to keystoneauth identity cli opts.Zhao Chao2018-01-161-133/+76
| | | | | | | | | | | | | | | | | | Use keystoneauth1 to parse keystone authentication arguments. Previously these arguments are parsed in the different service clients seperately. Use keystoneauth1 instead will make this consistent across projects and less error-prone. This change is inspired by NovaClient. Co-Authored-By: Morgan Fainberg <morgan.fainberg@gmail.com> Co-Authored-By: David Hu <david.hu@hp.com> Co-Authored-By: Monty Taylor <mordred@inaugust.com> Closes-Bug: #1734945 Change-Id: I3c5141eeddd3747ff542e95b04e4848470ad9508 Signed-off-by: Zhao Chao <zhaochao1984@gmail.com>
* Merge "Add cluster support in migration and manage"Zuul2017-12-011-33/+53
|\
| * Add cluster support in migration and manageGorka Eguileor2017-10-031-33/+53
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for API microversion 3.16, which allows us to pass --cluster optional argument to migration and manage operations. For this, a new type of CLI argument is added, the mutually exclusive arguments that can be used similarly to the utils.arg decorator, but with utils.exclusive_arg decorator. Implements: blueprint cinder-volume-active-active-support Change-Id: If004715b9887d2a0f9fc630b44d6e11a4a8b778d
* | Merge "Fix OS_AUTH_TYPE env var usage"Zuul2017-10-191-2/+4
|\ \ | |/ |/|
| * Fix OS_AUTH_TYPE env var usageGorka Eguileor2017-08-041-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Right now only deprecated OS_AUTH_SYSTEM environmental variable works to set the authentication to noauth, the reason is that we have multiple arguments writing on the same destination. This patch fixes this by making both arguments have the same default value, which is to use environmental variable OS_AUTH_TYPE if it has a value or deprecated OS_AUTH_SYSTEM if not. Closes-Bug: #1708687 Change-Id: I478fb0e628d4bebd4a1dc78c2559202916aa051f
* | Enable H306Eric Harney2017-08-011-0/+2
|/ | | | | | | | | Enforce ordering of imports with H306. For tests, this is mostly done by grouping test imports after other cinderclient imports. Change-Id: Ie40fda014d1aedb057e5b4ea1f27f999c84e6373
* Merge "Clean the redundant code in shell.py"Jenkins2017-08-011-12/+7
|\
| * Clean the redundant code in shell.pyjunboli2017-07-271-12/+7
| | | | | | | | | | | | | | In the file cinderclient/shell.py, packages requests and six are double imported. This patch is to clean the redundant code. Change-Id: I4bade57753a50245df1b4b82c4a8708d3b0acdba
* | Make --profile load from environment variablesTovin Seven2017-07-271-1/+3
|/ | | | | | | | --profile argument can be loaded from OS_PROFILE environment variables to avoid repeating --profile in client commands. Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com> Change-Id: Ia9b469024395327ec0ee082ddaea3234fc3ca5a6
* Fix attribute errors in os-auth-* settingsSean McGinnis2017-06-011-3/+2
| | | | | | | | | | | | This fixes some wording and formatting issues with the help text that is printed for CLI arguments. The duplication of default values for os-auth-system appears to lead to attribute errors requiring explicitly unsetting OS_AUTH_TYPE. Closes-bug: #1695054 Change-Id: I0263ef2fb15744f7e352c7365e7d9e61c1ebc974
* Merge "Add a missing left bracket in help message"Jenkins2017-05-251-1/+1
|\
| * Add a missing left bracket in help messageKATO Tomoyuki2017-03-221-1/+1
| | | | | | | | Change-Id: I8c6cfbefc45cd1e54ce9d15280c93b02114faf94
* | Fix noauth supportIvan Kolodyazhny2017-03-241-38/+52
|/ | | | | | | | | | | | | | | | | | | | | 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-19/+17
| | | | | | | | | 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
* Merge "Make V3 the default and fixup version reporting"2.0.0Jenkins2017-03-111-1/+1
|\
| * Make V3 the default and fixup version reportingJohn Griffith2017-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds in a version-list command that reports the min/max versions of the Cinder API supported by this version of the client, and also queries the Cinder API V3 server to obtain min/max micro-versions and report those as well. In addition, we bump the default version of the client to 3.0, of course if you specify V2 in your rc file or on the cmd line that works fine too. I did run into one problem where I broke: cinder.tests.unit.test_shell:test_cinder_service_name Seems to be some hidden trickery with a fake, fixture or mock that I can't figure out. For now I added a skip to that test, but maybe somebody can point out the problem during review. Change-Id: I44e667c511d89de28af758a3c9ea1f812e682f18
* | Handle log message interpolation by the loggerGábor Antal2017-02-071-2/+2
|/ | | | | | | | | | 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
* Python3 common patternsxianming mao2017-01-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Modify some codes in order to lead them meet the python3 common pattern. Look through the following patterns of Cinder, map() and filter() if a list is needed on Python 3: Replace map(func, data) with [func(item) for item in data] Replace filter(lambda obj: test(obj), data) with [obj for obj in data if test(obj)] Replace exceptions.OSError with OSError and remove "import exceptions" Replace iterator.next() with next(iterator) Replace basestring with six.string_types Replace unicode with six.text_type Replace (str, unicode) with six.string_types Replace "for key in dict.iterkeys()" with "for key in dict" Replace dict.iteritems() with dict.items() Replace dict.itervalues() with dict.values() I found that only "filter(lambda obj: test(obj), data)" and "map(func, data)"need to modify. The other items are not be founded in Cinder. Reference:https://wiki.openstack.org/wiki/Python3#Common_patterns Change-Id: If33ec39eb176c14086132d3099c6ec577f956ded
* Move trace ID print statement to finallyVipin Balachandran2016-11-181-7/+8
| | | | | | | | | If there is an exception raised by cinder-api while using --profile option, the trace ID is not printed. Moving the trace ID print statement to finally block to fix this. Change-Id: I03df8cd47185d148051d66396f6cd8118efff73c Closes-bug: #1642888
* Update --endpoint-type dest to os_endpoint_typeNate Potter2016-10-211-2/+2
| | | | | | | | | | | Currently the dest of the deprecated --endpoint-type arg is 'endpoint_type'. However, the code only uses 'os_endpoint_type' so right now it isn't being used at all. This patch updates the dest to be 'os_endpoint_type' so that the variable can be assigned correctly. Change-Id: Ie8592d12bcf95e4ccff571e831440b18f5acfd40 Closes-bug: #1454436
* Help msg and output info should support il8n.xianming mao2016-10-181-45/+45
| | | | | | | | Help msg and output info should support il8n. And delete the unused import six. Close-Bug: #1629157 Change-Id: Ie1faf0a83ec5f04dc6c8303f1ea0c931ba482e2a
* Print backtrace for exception when in debug modeEric Harney2016-10-111-1/+1
| | | | | | | | | | | | | | | | If the cinder shell is run in debug mode (CINDERCLIENT_DEBUG is set in the environment or with --debug), print a traceback for unhandled exceptions. This makes it possible to debug issues like this: $ cinder credentials ERROR: list indices must be integers, not str Related-Bug: #1631142 Co-Authored-By: Gorka Eguileor <geguileo@redhat.com> Change-Id: I5e9b3283602d404ab43494f15d57ec5abbcd77dc
* Removed multiple import from shell.pyGábor Antal2016-09-201-1/+0
| | | | | | | | | In shell.py, six is imported twice. In this patchset, one of them is removed. TrivialFix Change-Id: Ifbf6dcb20d5de54855aab53538b57eb11185ab2b
* Make APIVersion's null check more pythonicGorka Eguileor2016-08-291-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Our current APIVersion object has an is_null method to check when the version instance is null (major=0 and minor=0). While this works it is not very pythonic, since you have to write expressions such as: if not min_version and not max_version: return True elif ((min_version and max_version) and max_version.is_null() and min_version.is_null()): return True This patch removes the is_null method and instead implements the truth value testing to simplify expressions and make code more pythonic. So previous code would just look like: if not min_version and not max_version: return True Because this will work with min_version being None or being an APIVersion instance with major=0 and minor=0. Change-Id: I7497c5dc940c1e726507117cadbad232d8c1d80d
* Add "start_version" and "end_version" support to argparseCao Shufeng2016-08-161-11/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Now, "cinder help subcommand" can not show whether an argument is supported for a specific microversion. With this change, developers only need to add a start_version or end_version in the utils.arg wrap, cinderclient will support the microversion for that arguement. @utils.arg( '--foo', start_version='3.1') @utils.arg( '--bar', start_version='3.2', end_version='3.5') def do_some_action(): ...... In previous example, an exception will be raised for such command: $ cinder --os-volume-api-version 3.6 --bar some-ation And only "--foo" will show up for such help command: $ cinder --os-volume-api-version 3.1 help some-ation Change-Id: I74137486992846bbf9fdff53c009851db2356eef Partial-Bug: #1600567 Co-Authored-By: Nate Potter <nathaniel.potter@intel.com>
* Use 'six' instead of oslo_utils.strutils.sixdineshbhor2016-08-081-2/+2
| | | | | | | | | 'six' is an independent third party module so it doesn't need to be imported and used from oslo_utils.strutils. TrivialFix Change-Id: Icb3232bb1ebae0e8332e66c5806474d7f9dfd6df
* Use self.ks_logger instead of ks_loggerdineshbhor2016-08-011-2/+2
| | | | | | | | | | | | Currently with '--debug' option any cinder command only logs the request from keystoneauth and not the main cinder service request. Added keystoneauth logger to self.ks_logger so that logs can be logged as expected. Closes-Bug: #1606814 Change-Id: I7193aa6f43cb3186c49fc409b6e1ce7a36f596f9
* Switch to keystoneauthSteve Martinelli2016-07-231-10/+10
| | | | | | | | | | | 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 "Fix authentication issue"Jenkins2016-07-151-0/+3
|\
| * Fix authentication issueAbhijeet Malawade2016-04-271-0/+3
| | | | | | | | | | | | | | | | | | Fix authentication issue if password is provided from tty prompt. Set options.os_password to user input from prompt, as it gets used to create auth object otherwise it will give authentication error. Change-Id: I0246473f2165f1464d731e0ae9b4afa0b61dcbcc Closes-Bug: #1575656
* | Merge "OS_TENANT_NAME is not required when we have OS_PROJECT_NAME"Jenkins2016-07-151-2/+6
|\ \
| * | OS_TENANT_NAME is not required when we have OS_PROJECT_NAMEliyuanzhen2016-07-071-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cinder support both v2 and v3 auth. Use v3 if possible. In consideration of backwards compatibility, when we have OS_PROJECT_NAME, the v2 auth should be ok because tenant_name can be set by env[OS_PROJECT_NAME]. Change-Id: I9eed9c41a9deb5ecafa8d9e12f6d1b50d34f986d Closes-Bug: #1588261
* | | Log request-id for each api callAbhishek Kekane2016-06-281-21/+28
|/ / | | | | | | | | | | | | | | | | | | 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
* | Merge "Support --os-key option"Jenkins2016-05-181-0/+3
|\ \ | |/ |/|
| * Support --os-key optionCedric Brandily2016-05-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we can specify a client certificate key using --os-key option inherited from keystoneclient cli options but it has no effect because keystoneclient Session expects as cert argument, one of the followings: * None (no client certificate), * a path to client certificate, * a tuple with client certificate/key paths. The change updates cinderclient code to support the last case (ie: os_cert and os_key are non-empty) in order to take into --os-key option and OS_KEY environment variable. Closes-Bug: #1564646 Change-Id: I258fd554ad2d6a5413ffe778acefa3a0b83e591f
* | Support api-microversionsscottda2016-04-191-22/+14
| | | | | | | | | | | | | | | | | | Changes to cinderclient to use microversions. Implements: blueprint api-microversion-support-for-cinderclient api-microversion-support-for-cinderclient Change-Id: I840a1162b88e8ff36fa3fc4e1d6b9317104df3e0
* | Add /v3 endpoint support for cinderclientscottda2016-04-181-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Graduate to oslo.i18n and cleanup incubator usageRonald Bradford2016-03-241-2/+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
* Pass insecure option to HTTPClientCory Stone2016-01-271-0/+3
| | | | | | | This option was silently being ignored. Closes-Bug: #1538648 Change-Id: I3a1b5268e87cbc9803924be95b374d76b72a3a5d
* Make _discover_extensions publichuangtianhua2016-01-061-43/+1
| | | | | | | | | | | | Heat wants to use `cinderclient.shell.OpenStackCinderShell._discover_extensions` function (https://bugs.launchpad.net/heat/+bug/1527071), which is private currently. It's better to change this method to public for public use. This change will do it as novaclient did. Change-Id: Iaaa4cab530fd495877e15a372fff1354ddbeaa17 Closes-Bug: #1527169
* Set default service type to 'volumev2'Ivan Kolodyazhny2015-12-291-1/+1
| | | | | | | We are already use Cinder API v2 by default so it sould be consistent to use 'volumev2' service type by default Change-Id: I9f2da310f6ad53a40d476ede62369cc364371064
* Use oslo_utils encodeutils and strutilsEric Harney2015-11-231-2/+3
| | | | | | | | | | With oslo-incubator being deprecated, move our use of strutils to oslo_utils. This leaves in place the use of oslo-incubator's strutils by other oslo-incubator modules for now. Change-Id: Ic4e50060b42aeca9d1e54424a8a3a123140fbf2a
* Fully support os-endpoint-typeTom Hancock2015-09-281-11/+8
| | | | | | | | | | Fix Change-Id: I98a8507f2369deff6a6f7f8f08271b169fe651ad for bug #1454436 doesnt allow OS_ENDPOINT_TYPE environment variable to be used as a default for --os-endpoint-type as argparse takes the first definition of the default expression for dest=os_endpoint_type Closes-bug: 1500489 Change-Id: I76cc963b10bc7a549fe5a0cd2c73dfc6a30bb759
* Add a period for the description string of a argumentchenying2015-09-061-5/+5
| | | | | | | | This change add a period for the description string of a argument that gets dropped. Closes-Bug: #1489317 Change-Id: Ica1a74625a640f8d664f5ca183ada14ef63be077
* Set default OS_VOLUME_API_VERSION to '2'Ivan Kolodyazhny2015-07-301-1/+1
| | | | | | | | Cinder API v1.1 is deprecated and will be removed. Switching to API v2 in cinderclient makes it works well with new API after API v1 will be removed. Change-Id: I639f4b54dc7e220e8e351113a4de1dff104b50a7
* Merge "Remove unnecessary check for tenant information"Jenkins2015-07-201-30/+36
|\
| * Remove unnecessary check for tenant informationIan Cordasco2015-07-081-30/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keystone v3 has changed the name of tenants to projects which means that OS_TENANT_NAME is meaningless in a cloud where v3 is the default authentication version. As such, if a user does not have OS_TENANT_NAME enabled, cinderclient will not work even though it has checks for v3 immediately below this check (and the same check replicated further below that). Removing this allows cinderclient to work with Keystone v3 without setting OS_TENANT_NAME unnecessarily. Further, the check for project information was incorrectly referring to project_domain_name and project_domain_id instead of os_project_domain_name and os_project_domain_id. Closes-bug: 1472636 Change-Id: Ifabb4a2aec070c00349e794364a71394feea99f1