summaryrefslogtreecommitdiff
path: root/openstackclient/common
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix --enable options on commandsRichard Theis2016-06-021-0/+10
| | | | | | | | | | | | The --enable option on commands is ignored when the arguments are parsed. This is related to the --enable-beta-commands option. Renaming the option to --os-beta-command fixes the problem. There's no need to handle backwards compatibility for the option name change because there hasn't been an OSC release yet with beta commands. Change-Id: I0327ba8a2058858a83e9a42e231470ed733cc834 Closes-Bug: #1588384
* Add network support for "quota set"Fang Zhen2016-05-191-9/+50
| | | | | | | | | | The "quota set" command support compute and volume quotas previously. This patch add support network. Partially-implements: blueprint neutron-client-quota Closes-bug: 1489441 Change-Id: I9d297f52bc30614b3493f09ed15f8f1d3f8ff952
* remove #noqa from i18n importsSteve Martinelli2016-05-131-1/+1
| | | | | | hacking checks no longer fail on `import _` Change-Id: Idd60f0a0e71e5081691eacb39e5091ab08fcce6d
* Ignore domain related config when using with keystone v2Hieu LE2016-05-091-3/+3
| | | | | | | | | | | | Currently, "/usr/bin/openstack --insecure token issue" fails when OS_AUTH_URL and OS_IDENTITY_API_VERSION indicate keystone v2 if OS_PROJECT_DOMAIN_NAME or OS_USER_DOMAIN_NAME are set. This patchset ignore domain related configs if using with keystone v2 and print warning for each ignored config. Change-Id: I8afbda787df7855c3f8e868b0f07cbf3b9cd97fd Closes-bug: #1447704
* Ignore domain related config when using with keystone v2Hieu LE2016-05-061-0/+12
| | | | | | | | | | | Currently, "/usr/bin/openstack --insecure token issue" fails when OS_AUTH_URL and OS_IDENTITY_API_VERSION indicate keystone v2 if OS_PROJECT_DOMAIN_NAME or OS_USER_DOMAIN_NAME are set. This patchset ignore domain related configs if using with keystone v2. Change-Id: If7eea2ed1a4877c60d055ed0114a5e5f31e282a0 Closes-bug: #1447704
* remove assert in favor an if/elseMichael McCune2016-05-021-3/+2
| | | | | | | | | | | | | | the assert usage in the NonNegativeAction has the potential to allow unexpected behavior when the python is byte-compiled with optimization turned on. Changes * remove assert in favor of if/else in NonNegativeAction class * add type specifier to parser arguments for non-negative actions * correct tests for new int based values Change-Id: I093e7440b8beff4f179e2c4ed81daff82704c40e Closes-Bug: #1576375
* Support quota show for current projectRichard Theis2016-04-211-11/+18
| | | | | | | | | | The "os quota show" command "<project/class>" argument is now optional. If not specified, the user's current project is used. This allows non-admin users to show quotas for their current project. Change-Id: I602d4cc09c9d29ce84271eff78137f8810cb1a47 Closes-Bug: #1572733
* Propagate AttributeErrors when lazily loading pluginsTim Burke2016-04-142-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if an AttributeError was raised in a plugin's make_client method, the plugin simply wouldn't be an attribute of the ClientManager, producing tracebacks like Traceback (most recent call last): File ".../openstackclient/shell.py", line 118, in run ret_val = super(OpenStackShell, self).run(argv) ... File ".../openstackclient/object/v1/container.py", line 150, in take_action data = self.app.client_manager.object_store.container_list( File ".../openstackclient/common/clientmanager.py", line 66, in __getattr__ raise AttributeError(name) AttributeError: object_store This made writing minimal third-party auth plugins difficult, as it obliterated the original AttributeError. Now, AttributeErrors that are raised during plugin initialization will be re-raised as PluginAttributeErrors, and the original traceback will be preserved. This gives much more useful information to plugin developers, as in Traceback (most recent call last): File ".../openstackclient/shell.py", line 118, in run ret_val = super(OpenStackShell, self).run(argv) ... File ".../openstackclient/object/v1/container.py", line 150, in take_action data = self.app.client_manager.object_store.container_list( File ".../openstackclient/common/clientmanager.py", line 57, in __get__ err_val, err_tb) File ".../openstackclient/common/clientmanager.py", line 51, in __get__ self._handle = self.factory(instance) File ".../openstackclient/object/client.py", line 35, in make_client interface=instance._interface, File ".../openstackclient/common/clientmanager.py", line 258, in get_endpoint_for_service_type endpoint = self.auth_ref.service_catalog.url_for( PluginAttributeError: 'NoneType' object has no attribute 'url_for' Change-Id: I0eee7eba6eccc6d471a699a381185c4e76da10bd
* Merge "Support client certificate/key"Jenkins2016-04-061-0/+10
|\
| * Support client certificate/keyCedric Brandily2016-04-061-0/+10
| | | | | | | | | | | | | | | | | | | | This change enables to specify a client certificate/key with: * usual CLI options (--os-cert/--os-key) * usual environment variables ($OS_CERT/$OS_KEY) * os-client-config Change-Id: Ibeaaa5897ae37b37c1e91f3e47076e4e8e4a8ded Closes-Bug: #1565112
* | Don't mask authorization errorsHidekazu Nakamura2016-04-011-16/+9
|/ | | | | | | | | Project show with name argument returns 'Could not find resource' error when the user is not authorized. It should report the authorization error instead. This patch makes that change. Change-Id: Iac3521f8a411060b0ec9ef46c8f0e1f3551e56ae Closes-Bug: #1511625
* Remove unused method 'from_response'Wenzhi Yu2016-03-291-25/+0
| | | | | | | | 'openstackclient.common.exceptions.from_response' method is never called in openstackclient code base, so we should remove it. Change-Id: I04254a4e66863942e6c273d77bbd66ce2ce7804c Related-Bug: #1559072
* Trivial: Fix typo in common/limits.pyTang Chen2016-03-231-2/+2
| | | | Change-Id: I3040cc69512df50459960f96b862de55804068ac
* Fix dict.keys() compatibility for python 3Tang Chen2016-03-123-3/+3
| | | | | | | | | | In Python 2, dict.keys() will return a list. But in Python 3, it will return an iterator. So we need to fix all the places that assuming dict.keys() is a list. Change-Id: I8d1cc536377b3e5c644cfaa0892e40d0bd7c11b1 Closes-Bug: #1556350
* Fixed command listBrandon Palm2016-03-091-2/+18
| | | | | | | | | | | | | | | | | The cliff module expects an array of tuples however the array that this function was returning was an array of tuples that was also containing an array of values for the commands attached to each group and the cliff module wasn't liking it. The output now comes out looking like: | openstack.common | limits show | | | extension list | | openstack.baremetal.v1 | baremetal set | Change-Id: Ifa1c149cb5c66ba27dc72bf72d7c8f2f50e42f73 Closes-Bug: 1545609
* Trivial: Remove useless returnTang Chen2016-03-071-2/+0
| | | | | | If a function returns nothing, do not add return in the end. Change-Id: I298b8717462f68d3076a1619d674775be2a94c42
* fix: Exception message includes unnecessary class argsJas2016-02-291-2/+2
| | | | | | | | | Fix misusages of ArgumentTypeError which causes a tuple of class instance and error message string to be printed rather than just the error message string itsself. Change-Id: I0e997f86bb6603930cc92e90efcb48155f62ffb5 Closes-bug: #1551426
* Add MultiKeyValueAction to custom parser actionTang Chen2016-02-271-0/+81
| | | | | | | | | | | | | | Class MultiKeyValueAction will be used to parse arguments like this: --route destination=xxx,gateway=xxx --route destination=yyy,gateway=yyy The result is a list like this: [{destination:xxx, gateway:xxx}, {destination:yyy, gateway:yyy}] This action also contain validation of the parameters. Change-Id: Ie3aa8635c6a13fc2e429fe6922acd681dc7244cf
* Merge "Defaults are ignored with flake8"Jenkins2016-02-261-1/+2
|\
| * Defaults are ignored with flake8Tom Cocozzello2016-02-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | If “ignore” is not set under flake8 in the tox.ini file there there are defaults set to be ignored. The depended patch fixes many of the problems. Change-Id: Ieed2fe1c4654e201d3fe6d40ef93e247ee736f8b Doc: http://flake8.readthedocs.org/en/latest/config.html#default Depends-On: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d Closes-Bug: #1548910
* | Merge "Fixed a bunch of spacing"Jenkins2016-02-254-2/+5
|\ \ | |/
| * Fixed a bunch of spacingBrandon Palm2016-02-234-2/+5
| | | | | | | | | | | | | | Nothing too complicated here. I fixed a bunch of spacing issues that I saw in OSC. Change-Id: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d
* | Merge "Refactor network AZ exception handling"Jenkins2016-02-241-3/+2
|\ \ | |/ |/|
| * Refactor network AZ exception handlingRichard Theis2016-02-101-3/+2
| | | | | | | | | | | | | | | | Exceptions that occur while getting network availability zones should not be masked as if the extension does not exist. Change-Id: I07213ec6c4d83e97261b58bf8d42417c1cdfae6a Related-Bug: #1534202
* | Clean redundant argument to dict.getting.wang2016-02-213-10/+10
| | | | | | | | | | | | | | `dict.get()` returns `None` by default, if a key wasn't found. Removing `None` as second argument to avoid redundancy. Change-Id: Ia82f7469cd019509bbeccbfe54b15eeedc7bb6ea
* | Merge "Support unscoped token request"Jenkins2016-02-211-2/+20
|\ \
| * | Support unscoped token requestguang-yee2016-02-191-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | Make scope check optional for the "token issue" command as unscoped token is a valid Keystone V2/V3 API. Change-Id: Ie1cded4dbfdafd3a78c0ebdf89e3f66762509930 Closes-Bug: #1543214
* | | Merge "Fix Mutable default argument"Jenkins2016-02-211-2/+12
|\ \ \
| * | | Fix Mutable default argumentting.wang2016-02-201-2/+12
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python’s default arguments are evaluated once when the function is defined, not each time the function is called. This means that if you use a mutable default argument (like list and dict) and mutate it, you will and have mutated that object for all future calls to the function as well. more details about this wrong usage here: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments Change-Id: If187f16bfb305ac4fe6e4177e498a06c49c3f946
* | | Replace string format arguments with function parametersting.wang2016-02-201-2/+2
|/ / | | | | | | | | | | | | | | There are files containing string format arguments inside logging messages. Using logging function parameters should be preferred. Change-Id: I15b405bf4d4715263fe1e1262982467b3d4bc1f4 Closes-Bug: #1321274
* | Allow custom log levels for other loggersTerryHowe2016-02-051-9/+37
|/ | | | | | | | | | | | | | It would be convenient to be able to enable special logging for various components that openstack uses. The biggest thing is the --debug prints a lot of information when often all I want to see is the outgoing requests/responses. To get just that logged you would put this in your clouds.yaml: logging: keystoneclient.session: debug Closes-Bug: #1484660 Change-Id: I15c2607e8262f10903dd831ee8622fb5d6315310
* Merge "Support listing network availability zones"Jenkins2016-02-041-10/+56
|\
| * Support listing network availability zonesRichard Theis2016-02-021-10/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the "os availability zone list" command to support listing network availability zones along with the currently listed compute and volume availability zones. This adds the --network option to the command in order to only list network availability zones. By default, all availability zones are listed. The --long option was also updated to include a "Zone Resource" column which is applicable to network availability zones. Example zone resources include "network" and "router". If the Network API does not support listing availability zones then a warning message will be issued when the --network option is specified. This support requires an updated release of the SDK in order to pull in [1]. [1] https://bugs.launchpad.net/python-openstacksdk/+bug/1532274 Change-Id: I78811d659b793d9d2111ea54665d5fe7e4887264 Closes-Bug: #1534202
* | Merge "Allow wait_for_delete to work for all clients"Jenkins2016-02-041-2/+6
|\ \
| * | Allow wait_for_delete to work for all clientsMark Vanderwiel2016-01-281-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the exception and error status strings to be passed in such that other plugins can make use of this function. There is a comment in find_resource: The exception to catch here is dependent on which client library the manager passed in belongs to. Eventually this should be pulled from a common set of client exceptions. Since I think that is a long ways off, this change will work now and also work when a common exception is defined and used. Change-Id: Iab56cd1166028caed4f1e657e0b1ee81af3f48d8
* | | Merge "Add "os port show" command"Jenkins2016-02-031-0/+10
|\ \ \
| * | | Add "os port show" commandRichard Theis2016-02-021-0/+10
| | |/ | |/| | | | | | | | | | | | | | | | | | | Add "os port show" command. Change-Id: Id87c81640e74c60ae8f247c722c64fdadff022a2 Partial-Bug: #1519909 Partially-Implements: blueprint neutron-client
* | | Merge "Drop log_method decorator"Jenkins2016-02-021-27/+0
|\ \ \ | |/ / |/| |
| * | Drop log_method decoratorAkihiro Motoki2016-02-021-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a result of the recent logging refactoring, log_method decorator is no longer required. oslo.log provides a similar decorator oslo_log.helpers.log_method_call. If a similar feature is needed, we can use the decorator from oslo_log. searchlightclient is the only OSC external plugin which uses this decorator. The depending patch removes it, so we can safely drop the decorator. Change-Id: If3df09cf6aa0a401d9f89e8924adce851d0c6dec Depends-On: Ib94e7ba77262a9a8cbfce71f3083c47cb1973364
* | | Merge "Fix showing network quotas for a project"Jenkins2016-02-021-4/+7
|\ \ \ | |/ / |/| |
| * | Fix showing network quotas for a projectRichard Theis2016-02-021-4/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The OpenStack SDK is now used for the network client. However, the 'openstack quota show' command wasn't updated for the client change. As a result, the command will fail to show network quotas when a project name is specified. For example: $ openstack quota show admin 'Proxy' object has no attribute 'show_quota' This patch set fixes the command by using the OpenStack SDK to get network quotas for a project. Change-Id: I59a7b6780a7b80cd09e79d40d214751b25d3016e Related-To: blueprint neutron-client Closes-Bug: #1528249
* | log take_action parameters in a single placeAkihiro Motoki2016-02-028-60/+19
|/ | | | | | | | | | | | Previously each command logs take_action parameters explicitly by using @utils.log_method decorator or log.debug(). Some commands have no logging. This commit calls a logger in the base class and drops all logging definition from individual commands. Closes-Bug: #1532294 Change-Id: I43cd0290a4353c68c075bade9571c940733da1be
* Merge "Support listing volume availability zones"Jenkins2016-01-221-14/+61
|\
| * Support listing volume availability zonesRichard Theis2016-01-141-14/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the "os availability zone list" command to support listing volume availability zones along with the currently listed compute availability zones. This adds a --compute and --volume option to the command in order to select the availability zones to list. By default, all availability zones are listed. If the Block Storage API does not support listing availability zones then an warning message will be issued. Change-Id: I8159509a41bd1fb1b4e77fdbb512cf64a5ac11a9 Closes-Bug: #1532945
* | Merge "Refactor "os availability zone list""Jenkins2016-01-221-0/+102
|\ \ | |/
| * Refactor "os availability zone list"Richard Theis2016-01-141-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | Refactor the "os availability zone list" command to make it a common command instead of a compute-only command. Since availability zones are common to compute, volume and network (new), this refactoring allows availability zone support to be added for volume and network. In addition to the refactor, unit and functional tests were added. Change-Id: I63e9d41d229b21cd38e5a083493042c096d65e05 Partial-Bug: #1532945
* | log_method: get logger from decorated method if unspecifiedAkihiro Motoki2016-01-201-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes 'log' optional. 'log' attribute of each command class does not exist when the class is defined because 'log' is now setup dynamically when a class is instantiated. Instead log_method looks for a logger from a decorating method. compute.v2.server is changed in this commit as an example. Change-Id: Ic4d128f8e027d3b8e6f884f31369e9085c0f0871 Partial-Bug: #1532294
* | Set up logger of each command by metaclassAkihiro Motoki2016-01-201-0/+42
| | | | | | | | | | | | | | compute.v2.flavor is changed in this commit as an initial example. Partial-Bug: #1532294 Change-Id: I262af6ade0ae03fbe1cd2ad198faf4ebb4ecf7ce
* | Merge "Refactor network endpoint enablement checking"Jenkins2016-01-141-0/+20
|\ \ | |/ |/|
| * Refactor network endpoint enablement checkingRichard Theis2016-01-041-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the network endpoint enablement checking from the 'server create' command to the common client manager. This allows future network commands to use either nova or neutron networking based on the cloud environment. This patch set also includes related unit test enhancements to the common client manager to trigger authentication on the tests. Change-Id: Ia37e81d4fb05a1e2fceb3e5d367bda769ab8e64b Related-Bug: #1519511 Related-to: blueprint neutron-client