The positional decorator results in poorly maintainable code in
a misguided effort to emulate python3's key-word-arg only notation
and functionality. This patch removes keystoneclient's dependance
on the positional decorator.
Change-Id: I9e691cc8b0c04992f4a8dabd67e1b413d3220d23
1.As mentioned in [1], we should avoid using six.iteritems to achieve
iterators. We can use dict.items instead, as it will return iterators
in PY3 as well. And dict.items/keys will more readable.
2.In py2, the performance about list should be negligible, see the
link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: I18a6890935ebdbb589269379f21a0dd47d07eb3a
While building keystoneclient docs, there are currently 12 warnings
emitted that specify either:
WARNING: more than one target found for cross-reference u'list'
WARNING: more than one target found for cross-reference u'Auth'
This change specifies the correct object for the docstring with
"List" since there are many instances of "list" within
keystoneclient and specifies the proper "Auth" object. With these
changes, the warnings no longer appear.
Change-Id: I4515429df38760700552d48fc570c03abf116f83
As keystoneclient and other services rely more on keystoneauth we should
assume that keystoneauth is our base auth library, not keystoneclient
and start to default to the objects provided from there. This will make
it easier to remove these objects when the time comes.
Use the AUTH_INTERFACE special object from keystoneauth in most places.
This uses it everywhere that is actually session independant. For
example it is not changed within the keystoneclient auth plugins
themselves as they are directly compatible with keystoneauth.
Change-Id: Ibc1224fca98c852106feb78c624b0b2f22b3a19d
Currently tox ignores D401.
401: First line should be in imperative mood.
This change removes it and make keystoneclient docstrings compliant with it.
Change-Id: If34ff12d18390b357342cf29f2d116dd3c86a44d
Previously, there were a string of commits to keystone that addresed ignored
hacking checks. This commit does the same for H405 in keystoneclient. This
also modifies our tox.ini so that we no longer ignore H405 violations.
Change-Id: I2af152e5425a0e9c82314039fdbb90d661c22680
Closes-Bug: 1482773
If the user passes a Session in, we can pull the endpoint to use for
discovery from the Session itself, rather than erroring.
Closes-Bug: #1513839
Co-Authored-By: Dolph Mathews <dolph.mathews@gmail.com>
Change-Id: I82a41c67f80d2494f04739d82b112b7ff1dc4682
The comments indicated that creating a Discover without a
session is deprecated, but there was no warning generated.
Also, updated the Discover() parameter docstrings with the
standard deprecation info (e.g., in what release it's
deprecated and when we might remove it).
bp deprecations
Change-Id: I1d42b74aa72c15b95ac3c365b40d8c622869ed7e
Session.construct() wasn't properly deprecated since the deprecation
was only mentioned in the docstring. Proper deprecation requires use
of warnings/debtcollector and documentation.
bp deprecations
Change-Id: Ieff238aff9d39cfbbb80381b2392c33d0359acb3
Dicover.raw_version_data()'s unstable parameter wasn't properly
deprecated since it was only mentioned in the docstring. Prope
deprecation requires use of warnings/debtcollector and
documentation.
Also, fixed a place where the deprecated function could be used.
bp deprecations
Change-Id: I42dd7c1831bcfc3c637572eb112353b8760ed8d0
Dicover.available_versions() wasn't properly deprecated since it
was only mentioned in the docstring. Proper deprecation requires use
of warnings/debtcollector and documentation.
bp deprecations
Change-Id: Ifbcedec1d464435ebb9bcec779fadac0dfb28909
The functions to match a version or convert a string version number into
a tuple have shown to be useful in at least auth_token middleware. I
think this is also better as _discover should really only be a shadow
for the discover file because of the circular dependency problems.
_discover shouldn't really need to be used even within client.
Closes-Bug: #1400998
Change-Id: Icf700c30d01e0700e437437a23e63a7f100ce4d3
When the docs are rendered to HTML, any docs on __init__ are not
displayed. The parameters to the constructor have to be documented on
the class rather than on the __init__ method.
Also, corrected other minor issues in the same areas.
Change-Id: Ic56da33f6b99fe5efb636c289e3c4e1569f0c84c
Keystoneclient didn't provide translated messages. With this
change, the messages are marked for translation.
DocImpact
Implements: blueprint keystoneclient-i18n
Change-Id: I85263a71671a1dffed524185266e6bb7ae559630
The argument to the :raises: directive is the class name. If the
class name is a valid reference it's rendered as a link to the
class. This change cleans up the :raises: directives to use the
reference correctly and use a valid class reference.
Change-Id: I84188b60de0ab4c6b5b2fb5a203c43bfde094707
The :returns: directive doesn't take an argument. To specify the
return type, use the :rtype: directive.
Change-Id: I3aaab824792333b3f75a10af92f5b712cc9b4ff6
To maintain compatibility we must allow people to specify a versioned
URL in the service catalog but allow the plugins to return a different
URL to users.
We need this to be a general approach as other services will likely have
a similar problem with their catalog.
The expectation here is that a client will register the catalog hack at
import time rather than for every request.
Closes-Bug: #1335726
Change-Id: I244f0ec3acca39fd1b2a2c5883abc06ec10eddc7
The default state for session requests is that if there is an auth
plugin available then it should include a token in any requests. This is
a problem for cases where it is the authentication plugin itself trying
to do discovery (like in the case of version independent plugins)
because you end up in an infinite loop.
Allow controlling the authenticated parameter on discovery requests.
Closes-Bug: #1359457
Change-Id: Ib5ab0a3a30fe79139b7b5dcaae698438281b6d36
The existing discovery mechanism is geared around allowing users to
create appropriate client objects. It does not provide any means to
query version responses to determine the URLs of available versions.
This patch adds url_for (similar to the functions available on service
catalog) and data_for functions that can do lower level queries for
URLs and version response data.
Because of the client creation functionality the existing discover.py
cannot be imported from within keystoneclient due to cyclical dependency
resolution. The querying functions are therefore added to a private
keystoneclient file and exposed to the original Discover object via
inheritance. This private object can then be used within the
keystoneclient library.
Blueprint: endpoint-version-query
Change-Id: I7e1891536289c57ad3fbe8ef1c6e50b7344d83d5
Most services don't provide a 'values' element for their version
definitions, however are otherwise similar. Discovery should allow that
case and continue on otherwise.
Change-Id: I878377a779da5c96c47603842c024059920423fd
We don't need vim modelines in each source file, it can be set in
user's vimrc.
Change-Id: Ic7a61430a0a320ce6b0c4518d9f5d988e35f8aae
Closes-Bug: #1229324
Session.construct will create a session based upon the kwargs that used
to be passed to a client __init__ function. This will allow clients an
easy path to providing compatibility with deprecated arguments.
Make use of the function throughout discovery. Discovery was initially
released prior to the session object being completed and was therefore
handled with the same arguments as a client. Instead we should use a
session object so use the conversion function to convert those kwargs
into a session object if one is not provided.
Change-Id: I8dc1e0810ea6ebc6ea648ec37d7881825c566676
This patch adjust import items and add missing blank lines acording
to http://docs.openstack.org/developer/hacking/#imports
{{stdlib imports in human alphabetical order}}
\n
{{third-party lib imports in human alphabetical order}}
\n
{{project imports in human alphabetical order}}
\n
\n
{{begin your code}}
hacking project also enforce some checks for import group.
Let make the change in keytoneclient
Change-Id: Ic83bd5ee426905588f4a2d555851a9a01fc69f02
hacking 0.8 brings us bunch of python 3 compat rules.
Fix the python 3 compat issues to make this landable.
Change-Id: I0fbefefce92b506146e2bb833ffb0bd984b1c097
Partial-Bug: #1257301
Allow discovery of the API versions a server supports and create an
appropriate client based on this.
Implements: blueprint api-version-discovery
Change-Id: I63e6759889066a784dc47e35152c82e1ead7951d