Use osc-lib directly for exceptions.
Leave openstackclient.common.exceptions for deprecation period.
Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
The initial use of osc-lib is behind the compatibility/deprecation
modules that we will leave in place for a time for plugins to catch
up.
* openstackclient.common.exceptions
* openstackclient.common.utils
Module-level warnings are emitted directly on stderr since logging
has not been configured yet.
Change-Id: I79e57ce9523a20366bccaf9b949ab5906792ea0d
Currently OpenStackClient uses keystoneclient for authentication.
This change will update OpenStackClient to use keystoneauth for
authentication.
All dependant test have been updated.
Updating how auth_ref is set in the tests to use KSA fixtures had
some racy side-effects. The user_role_list tests failed when they
picked up an auth_ref that was a fixture. This exposed a weakness
in ListUserRole that needed to be fixed at the same time re
handling of unscoped tokens and options.
Change-Id: I4ddb2dbbb3bf2ab37494468eaf65cef9213a6e00
Closes-Bug: 1533369
The set --property command requires that the input match
the "key=value" type, but if the type don't match, the return
value will be None, and the command still can be implemented
successfully, this may confuse the users. I think we should
raise exception if the argument type don't match "key=value".
So I make some changes in KeyValueAction class in this patch.
Change-Id: I14e64922faa7e083bc8b5e7e1cac41ef8117c224
Closes-Bug: #1589935
I checked all the files in openstackclient/common
and fixed the missing i18n supprots.
Change-Id: Id7f76a24aae663f5832ef9bcf1bd5a6b7081af24
Partial-bug: #1574965
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
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
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
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
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
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
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
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
'openstackclient.common.exceptions.from_response' method is never called
in openstackclient code base, so we should remove it.
Change-Id: I04254a4e66863942e6c273d77bbd66ce2ce7804c
Related-Bug: #1559072
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
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
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
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
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
`dict.get()` returns `None` by default, if a key wasn't found.
Removing `None` as second argument to avoid redundancy.
Change-Id: Ia82f7469cd019509bbeccbfe54b15eeedc7bb6ea
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
There are files containing string format arguments inside logging messages.
Using logging function parameters should be preferred.
Change-Id: I15b405bf4d4715263fe1e1262982467b3d4bc1f4
Closes-Bug: #1321274
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
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
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
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
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