summaryrefslogtreecommitdiff
path: root/openstackclient/identity/v3/group.py
Commit message (Collapse)AuthorAgeFilesLines
* Support to add/remove multi users for "group add/remove user"Huanxuan Ao2017-03-211-20/+48
| | | | | | | | Similar delete commands in OSC, we can also support add/remove multi users for one specified group, this review implement it. Change-Id: I8ccf99d4ee83a18778fa3ff5c0a42bc7c6ff21fb Implements: bp support-multi-add-remove
* Narrow expected responses for CheckUserInGroupColleen Murphy2017-03-141-6/+9
| | | | | | | | | | | | | | | | | | | | When checking whether a given user is in a given group, keystone will return a 404 Not Found if all went well but the user was not in the group. It may also return a 403 if the user and the group are in different backends, which would also mean that the user was not in the group[1]. Any other 400 response is a client error and any 500 response is a server error to which the user should be alerted. Without this patch, openstackclient treats any exception as a valid "not found" and may end up hiding server errors. This patch reduces the caught exceptions to 403 and 404 responses and treats everything else as an error. [1] https://developer.openstack.org/api-ref/identity/v3/?expanded=check-whether-user-belongs-to-group-detail#check-whether-user-belongs-to-group Closes-bug: #1672634 Change-Id: Id3f3b2409b7cee480ee3c19b6d6c3070599ffe8f
* Modify error handling for role and group commandsHuanxuan Ao2017-02-091-18/+8
| | | | | | | | | | if command failed, we usually raise exception, if command success, sometimes there is not any output (such as set, add commands) So modify the error handling for role and group commands. Change-Id: I1c0f86c04dcedd9c0d725fd73f3436be9da75ee0
* Error handling for delete commands in identityHuanxuan Ao2017-01-031-4/+18
| | | | | | | | | Add missing multi deletion error handling for identity delete commands. All delete commands in identity support error handling now. Change-Id: I05626dcb5e516a423d610906347b02236ba7eeaf
* translate all command help strings3.4.0Steve Martinelli2016-11-171-8/+8
| | | | | | | | | | | | | | Leverage the new cliff command class attribute (_description) to get the help of a command, this allows us to mark strings for translation. We could not do this before since the help was grabbed from the docstring. This also depends on a new release of cliff and a bump to the minimum level in osc's requirements. Closes-Bug: 1636209 Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
* Remove execute permission on a few filesSongmingYan2016-07-221-0/+0
| | | | | | | Some files have execute permission unnecessarily. Change them from 755 to 644. Change-Id: I471ebd1c3d123ad4a7376f7f5996f53f8c2d9b0b
* Make set/unset commands pass normally when nothing specified in identityv3Huanxuan Ao2016-07-141-3/+0
| | | | | Change-Id: I554b41969f96b62a2c6d37024caa56b1441d5ed1 Partial-bug: #1588588
* Correct reraising of exceptionqinchunhua2016-07-071-2/+2
| | | | | | | | | When an exception was caught and rethrown, it should call 'raise' without any arguments because it shows the place where an exception occured initially instead of place where the exception re-raised. Change-Id: I5fb6dea5da7fb6e1e2b339a713c7d37f8c99e407
* Standardize logger usageTang Chen2016-06-201-1/+5
| | | | | | | | | | | | | | | | | | | Use file logger for all command specific logs. This patch also fixes some usage that doesn't follow rules in: http://docs.openstack.org/developer/oslo.i18n/guidelines.html After this patch, all self.log and self.app.log will be standardized to LOG(). NOTE: In shell.py, we got the log in class OpenStackShell, which is also known as self.app.log in other classes. This logger is used to record non-command-specific logs. So we leave it as-is. Change-Id: I114f73ee6c7e84593d71e724bc1ad00d343c1896 Implements: blueprint log-usage
* osc-lib: commandDean Troyer2016-06-131-1/+1
| | | | | | | Leave command.py and test_command.py as a sanity check during the deprecation period. Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
* osc-lib: utilsDean Troyer2016-06-131-2/+2
| | | | | | | | Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
* Fix i18n support problems in identityTang Chen2016-06-071-33/+55
| | | | | Change-Id: I3b48d17850343051239b5b69e8b890dba32d3ac8 Partial-bug: #1574965
* Add newline to strings in stdout/stderr.write()Lu lei2016-06-061-1/+1
| | | | | | Function stdout/stderr.write() can't break line automatically. Change-Id: I903c2d1cc1a669adb6be5aa4eb783d3b9943e685
* remove #noqa from i18n importsSteve Martinelli2016-05-131-1/+1
| | | | | | hacking checks no longer fail on `import _` Change-Id: Idd60f0a0e71e5081691eacb39e5091ab08fcce6d
* take_action() method from command.Command shouldn't returnMohan Muppidi2016-02-291-2/+0
| | | | | | | | | | | | command.Command and command.Showone are base classes implemented in cliff framework. Showone extends Command to allow take_action() to return data to be formatted using a user-selectable formatter. Most of the classes which are extended from Command in openstackclient/identity/v3/ in some cases return data or return nothing where it is not necessary, this commit fixes most of them. Change-Id: I84c72ea4d6680f8bdbef5449316dd9a8af8c8286 Closes-Bug: 1550892
* log take_action parameters in a single placeAkihiro Motoki2016-02-021-31/+4
| | | | | | | | | | | | 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
* Switch to ksa SessionDean Troyer2015-12-021-2/+2
| | | | | | | | * Change session imports to keystoneauth1 * Change keystoneclient.exception imports to keystoneauth1 * Change exceptions raised from internal API from keystoneclient to openstack.common Change-Id: I046d89f561d6fe04baae53726f9749d2e7fe2056
* Use a common decorator to log 'take_action' activationJoshua Harlow2015-09-011-8/+8
| | | | | | | | | Instead of duplicating the same log statement throughout the code, the same logic can be provided by a shared decorator that abstracts away the logging capability and unifies it behind a common function instead. Change-Id: Icc63bced7347c8bbf0299a4c5821425a10892a79
* Refactor option handling for user|group|project domain scopingSteve Martinelli2015-06-171-49/+7
| | | | | | | put the common options in identity.common, this way the help is consistent Change-Id: I5b09cfb56fa0f8d16feb95150f216fccbe9f2b22
* Enable specifying domain for group and role commandsJuan Antonio Osorio Robles2015-06-081-33/+83
| | | | | | | | | Many of the commands for the group and role resources were lacking an option to specify the specific domain groups, projects or users belong to. This commit fixes that. Change-Id: I461d2bcfd01ad2dea970de38ec7ad6f4a631ceb1 Closes-bug: #1446546
* remove unnecessary conditionalsSteve Martinelli2015-04-191-4/+3
| | | | | | | | In several places we had else branches where a reasonable default would do the job. This makes the code a mean cleaer and easier to read. Change-Id: I231e09aab85fd32b8300bc33c48d0899b728b96e
* Restrict groups and users from changing domainsSteve Martinelli2015-02-091-7/+1
| | | | | | | | | | Similar to projects, we shouldn't allow users and groups to change domains. The server side tosses up an error but osc should restrict that behaviour in the first place. Related-Bug: #1418384 Change-Id: I860291a5859c576021b18e35d1a12c32abfb6ca5
* Command docs: groupDean Troyer2015-01-031-18/+21
| | | | | | Fix up formatting for group command docs and help Change-Id: Icda79842d52da90d5eac2b0fdbc0d576d371378d
* add doc for group commandwanghong2014-12-241-18/+18
| | | | Change-Id: Iaaa0aeb42f9f940af63863f5d09011b5f7529281
* add multi-delete support for identitywanghong2014-12-231-11/+14
| | | | | | | | | | | | | | This is part2. Add support for these objects: identity.project(v2.0) identity.role(v2.0) identity.user(v2.0) identity.project(v3) identity.role(v3) identity.user(v3) identity.group(v3) Closes-Bug: #1400597 Change-Id: I270434d657cf4ddc23c3aba2c704d6ef184b0dbc
* Don't import form keystoneclient.openstack.commonJamie Lennox2014-12-171-1/+1
| | | | | | | | The keystoneclient.openstack.common directory is where we sync files from oslo incubator. It is not a public directory and should not be being consumed by openstackclient. Change-Id: I011bb95c2c824e2dbc4b822ca922ae77b8d9b955
* Add support for domains when deleting identity v3 resourcesSteve Martinelli2014-12-011-1/+15
| | | | | | | | | | Currently, only deleting via IDs is possible for groups, projects and users. We should have an optional --domain argument that allows for a name to be specified for the resource. (Since these are all namespaced by domains). Change-Id: I18ace3db85a3969f0b97678d432d6f8368baa9cd
* Add --or-show support for v3 identity resourcesSteve Martinelli2014-11-181-5/+21
| | | | | | | | | | | | Add --or-show for the following: * v3 roles * v3 projects * v3 domains * v3 users * v3 groups Closes-Bug: #1390389 Change-Id: Id4ef043e5fda6be49a515eb3fe138c813c393ec9
* Remove 'links' section from several v3 Identity objectsSteve Martinelli2014-10-111-3/+3
| | | | | | | | | | | | | | | The links field in the returned objects from the v3 Identity API aren't really useful, so let's remove them. Managed to remove most of them from the core API. I'll likely remove the extension/contribution (oauth/federation) related ones in another patch. Also in this patch the code for setting services and projects was changed. Though not incorrect, it was not needed to copy the entire returned object, we should just need to pass in the fields we want to update. Change-Id: I164ca9ad8b28fa10b291e9115ef40753e387c547
* Allow --domain to be used for identity commands without lookupNathan Kinder2014-10-091-11/+7
| | | | | | | | | | | | | | | | | Performing create, list, or set operations for users, groups, and projects with the --domain option attempts to look up the domain for name to ID conversion. In the case of an environment using Keystone domains, it is desired to allow a domain admin to perform these operations for objects in their domain without allowing them to list or show domains. The current behavior prevents the domain admin from performing these operations since they will be forbidden to perform the underlying list_domains operation. This patch makes the domain lookup error a soft failure, and falls back to using the passed in domain argument directly as a domain ID in the request that it sends to Keystone. Change-Id: I5139097f8cedc53693f6f71297518917ac72e50a Closes-Bug: #1378565
* Add domain parameters to user show for Identity V3Steve Martinelli2014-10-091-5/+18
| | | | | | | | | | | Update `user show` for Identity V3 to account for a domain argument, in doing so, also update `find resource` to be more flexible by allowing **kwargs. Also update `group show` and `project show` since they follow the same logic as a user within a group. Change-Id: Ib828e4dbeb0bd31164396069ce8a64c873179779 Closes-Bug: #1378165
* Complete Identity v3 list command filtersDean Troyer2014-06-191-11/+36
| | | | | | | Complete the 'group list' and 'user list' filter options following the refactor in https://review.openstack.org/69878 Change-Id: Ib4af417c56d4f7da4b88852f191af615cc7fa2ec
* Refactor role list subcommand for identity v3 apiQiu Yu2014-06-131-75/+5
| | | | | | | | | | | | | | | Currently parts of user list and group list command are actually functioning as role listing, which is quite counter intuitive and misleading. This refactor change move role related logic to a single place of role list command. It now allows role grants listing for user/group + domain/project combinations. If no user or group specified, it will list all roles in the system, which is the default behaviour. Change-Id: I4ced6df4b76f018d01000d28b4281ad9f252ffcc
* replace string format arguments with function parametersChristian Berendt2014-05-201-8/+8
| | | | | | | | There are files containing string format arguments inside logging messages. Using logging function parameters should be preferred. Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
* Pass arguments to v3 keystoneclient by kwargJamie Lennox2014-04-041-1/+1
| | | | | | | | | Keystoneclient has added the positional decorator which emits a warning if arguments aren't passed by keyword. This means we are getting warnings in certain places in openstackclient. Change-Id: Ic5446cd6f122cbb56fce543011386d53bc31fe18 Closes-Bug: #1302199
* Fix some help stringsAndreas Jaeger2014-02-211-1/+1
| | | | | | | | | | This fixes some errors and inconsistencies I found reviewing the help strings: * Capitalize help strings * Add missing space between words (in multi-line strings) * Improve wording Change-Id: I2fb31ab4191c330146e31c1a9651115a6657769a
* Begin Python 3 compatabilityDean Troyer2013-07-291-3/+4
| | | | | | | | | | | * use six.iteritems() * replace basestring with six.string_types * convert print statements to functions (they're all debugging and should be removed eventually anyway) * clean up OpenStack copyright: LLC -> Foundation Change-Id: Icb14212bcb408e63816bfec3922a697bc1a6c946
* Remove api = apiName calls from each methodSteve Martinelli2013-07-121-8/+0
| | | | | | | | | | | As discussed in https://review.openstack.org/#/c/36352/ for each command, we were setting api = identity or volume... etc, this was for an old way of calling commands that are is no longer used. Also removed openstackclient/common/command.py Change-Id: I2705f35d343f2ae729dc22d6aed0b852b2f8ca19
* Merge "Finish up v3 role commands"Jenkins2013-07-051-7/+88
|\
| * Finish up v3 role commandsSteve Martinelli2013-07-031-7/+88
| | | | | | | | | | | | | | | | | | | | | | | | * Add remove role * Add --role to group list * Add --role to user list * Fix groups in AddRole() * Remove the tweaks to utils.find_resource for domains; will address that across domains, projects, users and groups in another patch. I want to nail down the structure of these commands and get that into place Change-Id: I8673dd8221ef88978dada5a2833c187026bdb31a
* | Add methods for user and group interactionsSteve Martinelli2013-07-021-0/+117
|/ | | | | | | | * Add user to group * Contains user in group * Remove user from group Change-Id: If5219fa9d4761d7b97950c39556b3e1b8aab6517
* Fix flake8 errors in anticipation of flake8 patch.Monty Taylor2013-05-141-1/+2
| | | | Change-Id: Ifdc4322b699f2bd91a6900e55695acd3d736568e
* Upgraded to PEP8 1.3.3 to stay aligned with Nova, etc.Josh Kearney2013-01-311-35/+18
| | | | | | | | Made all the necessary changes to pass new PEP8 standards. Also cleaned up docstrings to conform to the HACKING stanards. Change-Id: Ib8df3030da7a7885655689ab5da0717748c9edbe
* v3 identity - group and project apiSteve Martinelli2013-01-281-0/+204
updated with latest comments modified entry points in setup.py added group.py (v3) added project.py (v3) fixed indentation updated to include new headers Change-Id: Ice68b6c5bacb68d2e95321d903043056a9b8e810