37 Commits

Author SHA1 Message Date
Brant Knudson
3c8d35247e Correct documenting constructor parameters
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
2014-12-04 19:04:15 -06:00
Jamie Lennox
b0e68b06b3 Make keystoneclient use an adapter
Apart from making keystoneclient follow the same patterns of using an
adapter that we are trying to push onto other clients this severs the
cyclical dependency between managers and the client object.

There are a few changes that have had to be rolled into one to make the
transition work. These can't be separated unfortunately as they are
interdependent.

* managers are now passed the adapter instead of the client. They
  therefore don't have reference to the other managers on the client.
* The adapter has been subclassed to provide user_id as there are some
  managers that require user_id be provided for changing passwords etc.
* client.auth_url has been replaced with a call to get_endpoint which is
  supported by the adapter.
* management=True has been removed from all the managers and they now
  correctly set the interface they want.

Change-Id: I49fbd50571f0c1484e1cbc3dcb2159d25b21b1bc
2014-11-21 08:03:23 +10:00
Brant Knudson
fece74ca3e I18n
Keystoneclient didn't provide translated messages. With this
change, the messages are marked for translation.

DocImpact

Implements: blueprint keystoneclient-i18n

Change-Id: I85263a71671a1dffed524185266e6bb7ae559630
2014-10-28 20:33:19 +00:00
Rodrigo Duarte Sousa
bc50c9e48f Extracting common code to private method
Created a private method to build URL queries.

Change-Id: Iaa480443e34073fa39d13d2452cd13c267a2bdd5
2014-09-24 21:22:29 -03:00
Adam Young
a82d4a6921 Enumerate Projects with Unscoped Tokens
Creating a client with a session using an Unscoped tokens now sets auth
info in client.  This Auth Info is necessary in order to enumerate
projects.  This is the standard login path for Horizon.

Change-Id: I688a27cd0e7c98e7cf899ac65bb593a85171813f
2014-09-23 13:47:35 +00:00
Jamie Lennox
0e9ecaa154 Don't log sensitive auth data
Add the ability to turn off logging from the session object and then
handle logging of auth requests within their own sections.  This is a
very simplistic ability to completely disable logging.  Logging more
filtered debugging can be added later.

This new ability is utilized in this patch to prevent logging of
requests that include passwords.  This covers authenticate, password
change, and user update requests that include passwords.

SecurityImpact
Change-Id: I3dabb94ab047e86b8730e73416c1a1c333688489
Closes-Bug: #1004114
Closes-Bug: #1327019
2014-07-24 07:47:34 -07:00
Jamie Lennox
a58bb4b27a Allow passing kwargs from managers to session
Resource managers may need to pass certain overrides down to the session
layer. The most common example would be to allow them to specify a
different interface to issue a request to than is common. It is possible
later that we may wish to expose this ability to users as well so that
they can choose in there own programs what interface, endpoint name etc
a particular request should be issued to.

Change-Id: I7ee0931d4ea78cf9f463b2f0b54457226c5bea8d
2014-07-23 12:32:27 +10:00
Christian Berendt
b530800649 fixed typos found by RETF rules
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos

Change-Id: I67fb3e0d02c931cb7e605ac74ea8272956afa8e1
2014-05-03 09:54:39 +02:00
Andrey Kurilin
608668aa4b Use Resource class from Oslo
Most methods of Resource class from keystoneclient are similar to methods
from common code.
In the process of unification of the clients code we should
reuse common functionality from Oslo.

Related to blueprint common-client-library-2

Change-Id: I5858eec1596a6921dcf49dfcefb7abd4387de73b
2014-02-17 12:36:38 +02:00
Eric Guo
d6d0d66374 Remove vim header
We don't need vim modelines in each source file, it can be set in
user's vimrc.

Change-Id: Ic7a61430a0a320ce6b0c4518d9f5d988e35f8aae
Closes-Bug: #1229324
2014-02-08 22:22:08 +08:00
Cyril Roelandt
4d05acad99 Prevent dictionary size from changing while iterating over its items
In Python 3, dict.items() returns 'a dict_item'. Iterating over it while
deleting some of the dictionary elements is forbidden. We have to iterate over
a list to avoid getting this error:

    RuntimeError: dictionary changed size during iteration

Change-Id: I43401e6eb9a31148fda4677644bf99e1b739d0dd
2014-01-06 19:16:16 +01:00
Cyril Roelandt
11eb5109a1 Python3: replace urllib by six.moves.urllib
This makes the code compatible with both Python 2 and 3.

Change-Id: I721a5567842f2df6ce2a8af501787204daba3082
2013-12-12 15:11:51 +01:00
fujioka yuuichi
9b6533bbc0 Apply six for metaclass
The way to using metaclass has changed in Python3.

Python 2.7 way:

class Foo(object):
  __metaclass__ = FooMeta

Python 3 way:

class Foo(object, metaclass=FooMeta):
  ...

The six.add_metaclass() decorator allows us to use one syntax that
works for both Python 2.7 and Python 3.

Change-Id: I08703a8b2927f45f4705fe085368d1ebd78b02fa
Closes-Bug: #1236648
2013-10-18 14:23:02 +09:00
Jenkins
876c2d6c2a Merge "python3: Refactor dict for python2/python3 compat" 2013-10-16 23:44:20 +00:00
ZhiQiang Fan
0774d5aafa Replace OpenStack LLC with OpenStack Foundation
Some files still use trademark OpenStack LLC in header, which
should be changed to OpenStack Foundation.

NOTE: tools/install_venv.py is not touched, should sync with oslo

Change-Id: I01d4f6b64cf1a152c4e190407799ce7d53de845f
Fixes-Bug: #1214176
2013-10-17 01:19:01 +08:00
Chuck Short
3027e89036 python3: Refactor dict for python2/python3 compat
Python3 changed the behavior of dict.keys such that it is now
returns a dict_keys object, which is iterable but not indexable.
You can get the python2 result back with an explicit call to list.

Change-Id: Ic504d3929398aa82ac87d1735cf4cedea2dfc5d1
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-10-11 13:32:54 -04:00
Alessio Ababilov
ebba21bda8 Standardize base.py with novaclient
Main changes:
* deprecate api variable in favour of client
* add documentation
* use to_slug from oslo strutils
* remove Python 2.4 support
* other small fixes from novaclient

Change-Id: Ife54fd3207798ee03101a48bc1cda3b3f62cc5e4
2013-08-27 13:48:19 +03:00
Dirk Mueller
dc5c33a9e5 Fix and enable Gating on H404
Enable gating on the Hacking H404 check - docstring
should start with a summary.

Change-Id: I80612a15bd11f689e9e9f4dc2ff812138630ddbd
2013-08-15 20:35:35 -07:00
Jamie Lennox
50e405dfe6 Reorganize url creation.
Make build_url extract used parameters from keyword arguments so they
are not sent as the body to create, or as query parameters.
Allow specifying a class level base_url that is used unless one is
specifically provided.
Break filtering function into a decorator as it seems the perfect
usecase and it prevents a dictionary copy.

Fixes: bug 1198772
Change-Id: I6d370ed504c300b9997199f351322e3083650c69
2013-07-29 13:50:50 +10:00
Jenkins
2ec2e7ee31 Merge "Add find() method to CrudManager" 2013-06-06 13:11:21 +00:00
Dean Troyer
e7162cbbcc Add find() method to CrudManager
Add a find() methods to CrudManager to maintain compatability
with existing CLI lookups using utils.find_resource().

Change-Id: Ia9b38b975bb88fb361f3471b66f98c7e81bbc6de
2013-05-30 16:04:44 -05:00
Alessio Ababilov
c0ed25ee60 Make ManagerWithFind abstract and fix TokenManager
ManagerWithFind requires list() method in its descendants.
Make it abstract and fix its improper descendant TokenManager
that do not implement list().

Change-Id: I83ae47d894c02d5cd1eb0da437dd05796d0b0160
Fixes: bug #1180393
2013-05-19 18:21:06 +03:00
Dolph Mathews
28dc9b38a7 Revert "Use TokenManager to get token"
This reverts commit 22228f526d6ea08b7006be1287afe959b93c23db which appears to be breaking the keystone gating
2013-04-30 17:34:14 +00:00
Julien Danjou
22228f526d Use TokenManager to get token
Instead of implementing token retrieval twice, let's use the code provided
by the TokenManger to get a token in raw format from Keystone.

Change-Id: I769be118ee137580cabd5cabcf7843e7afe1e456
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-19 04:26:17 +00:00
Ken'ichi Ohmichi
9351665062 Add name arguments to keystone command.
This patch adds name arguments to the following subcommands:
  * role-delete
  * role-get
  * service-delete
  * service-get
  * tenant-delete
  * tenant-get
  * tenant-update
  * user-delete
  * user-get
  * user-password-update
  * user-role-add
  * user-role-list
  * user-role-remove
  * user-update

Fixes bug 1100648

Change-Id: I73c08c0ba553a72ec57ff3a684a00be4ef1294a6
2013-01-17 18:11:27 +09:00
Dean Troyer
51dc6a0cef Use requests module for HTTP/HTTPS
* Implement correct certificate verification
* Add requests to tools/pip-requires
* Fix OS_CACERT env var help text
* Add info to README
* Rework tests to use requests

Pinned requests module to < 1.0 as 1.0.2 is now current in pipi
as of 17Dec2012.

Change-Id: I120d2c12d6f20ebe2fd7182ec8988cc73f623b80
2012-12-18 15:30:43 -06:00
Derek Higgins
1f6a0af9c1 Add command to allow users to change their own password
Fixes Bug 1082539

The Equivalent of doing
curl -X PATCH http://localhost:5000/v2.0/OS-KSCRUD/users/<userid> \
    -H "Content-type: application/json"  \
    -H "X_Auth_Token: <authtokenid>" \
    -d '{"user": {"password": "ABCD", "original_password": "DCBA"}}'

Change-Id: Ia1a907c5fd138c4252196145b361f43671047a1a
2012-11-27 09:14:14 +00:00
Joe Heck
0fddc40e88 fixes 1075376
removes setting loaded=True on resource loads where it hasn't been fully
loaded - breaking keystone master tests

Change-Id: I889782d605637f7d5bbd2462d1a2dfb1574e4624
2012-11-06 17:25:07 +00:00
Dolph Mathews
0ee5147030 Fixed httplib2 mocking (bug 1050091, bug 1050097)
- 204 No Content should be mocked with empty response bodies
- Content-Type headers should not be mocked with empty response bodies
- httplib2 would never return None as a response body
- The Identity API never expects a req/resp body with a string value of "null"

Change-Id: Ie22e8e5288573268165ed06049978195955f8ca6
2012-10-09 22:58:20 +00:00
Dolph Mathews
315285e76a Manager for generic CRUD on v3
Change-Id: I15944f2e171e26b5209b55356edd1110b301310c
2012-10-04 09:25:56 +00:00
Dolph Mathews
703c8b340c Add generic entity.delete()
Change-Id: I00188326b6343a4eb4d1dd1b6a24e691ffd30415
2012-09-11 11:10:00 -05:00
Dolph Mathews
b91cdf492a Add support for HEAD and PATCH
Change-Id: Ic874c49b791e9d2cb3d44b15511cbb467a551589
2012-09-11 11:06:54 -05:00
Dolph Mathews
4e0af25f22 Don't need to lazy load resources loaded from API
Change-Id: Ibff7feabc8cba062bc9367c6755279b88a9a3c04
2012-09-11 09:10:39 -05:00
Joe Heck
52b392281e pep8 1.1 changes and updates
Change-Id: I8bc3582bb3f35a3d841bb1e8c03b62ba61ff92d7
2012-06-01 18:07:26 -07:00
Tihomir Trifonov
a1f927e899 Fixes user update methods.
1. Fixes the url for user update methods to reflect extension status,
   e.g. 'users/{user_id}/tenant' to 'users/{user_id}/OS-KSADM/tenant',
   as per Keystone API.

2. Fixes the update_user method, as it expects a POST instead of PUT.

Change-Id: I045ca7650b2ef8969af695900da1b4f62d4da6bd
2012-02-15 15:56:03 -08:00
Gabriel Hurley
2914c2b1d1 Updates client to work with keystone essex roles API routes.
Also adds pep8 to requirements since it was missing, and adds the
automatically-created venv to the gitignore list.

Change-Id: Iafa05c1889d7706b79d0f9392a9ac24f2f5a1719
2012-01-28 18:43:19 -08:00
Gabriel Hurley
17f6b83ee6 Initial commit. 2011-10-25 16:50:08 -07:00