40 Commits

Author SHA1 Message Date
Dean Troyer
9e2b8e6730 osc-lib: command
Leave command.py and test_command.py as a sanity check during the
deprecation period.

Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
2016-06-13 11:00:22 -05:00
Dean Troyer
be192676bd osc-lib: parseractions
Leave parseractions.py and test_parseractions.py as a sanity check during the
deprecation period.

Change-Id: I1a7469b6d872284e0276502a1a287bc0b87f8f83
2016-06-13 10:55:44 -05:00
Dean Troyer
e5e29a8fef osc-lib: utils
Use osc-lib directly for utils.

Leave openstackclient.common.utils for deprecation period.

Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
2016-06-13 10:50:44 -05:00
Tang Chen
5293bb103e Fix i18n support problems in identity
Change-Id: I3b48d17850343051239b5b69e8b890dba32d3ac8
Partial-bug: #1574965
2016-06-07 09:37:02 +08:00
Steve Martinelli
ebcbd6ba71 remove #noqa from i18n imports
hacking checks no longer fail on `import _`

Change-Id: Idd60f0a0e71e5081691eacb39e5091ab08fcce6d
2016-05-13 13:14:02 -07:00
Mohan Muppidi
3d7430463c take_action() method from command.Command shouldn't return
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
2016-02-29 17:23:29 +00:00
Akihiro Motoki
258c1102cc log take_action parameters in a single place
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
2016-02-02 09:58:32 +09:00
Jude Job
66931c6931 Enabling domain lookup for project set v3 command
Currently the domain option for `project set` attempts to set
a new domain that owns the project. This is actually an action
that is denied by keystone server. Instead, the domain option
should be used as a lookup, to find projects that exist in the
non-default domain.

Co-Authored-By: Steve Martinelli <stevemar@ca.ibm.com>

Closes-Bug: #1524456

Change-Id: I30a3812184fe262667e09baa106d2275c2cbb981
2015-12-31 02:11:39 -05:00
Dean Troyer
bf090c69c2 Switch to ksa Session
* 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
2015-12-02 01:55:14 +00:00
Joshua Harlow
e3c46ece4a Use a common decorator to log 'take_action' activation
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
2015-09-01 16:49:54 -07:00
Rodrigo Duarte Sousa
4fab606349 Enables retrieval of project's parents and subtree
Adds the possibility to retrieve a project and list its
parents and subtree in the hierarchy.

Co-Authored-By: Rodrigo Duarte <rodrigods@lsd.ufcg.edu.br>
Co-Authored-By: Samuel de Medeiros Queiroz <samuel@lsd.ufcg.edu.br>

Implements: bp hierarchical-multitenancy

Change-Id: I874f6faffc8a2db9d99f12cbe0a69c0a30c0d9df
2015-06-09 13:10:22 -03:00
Guojian Shao
542f587364 add --domain argument to v3 project set
Currently argument 'domain' is not supported by command 'os project
set', but it is required by keystone v3 update project API to match
the domain id.

Closes-Bug: #1460122
Change-Id: I1b32f67f78b369f6134a74cdf9a4811b7539d44b
2015-05-29 22:42:42 -04:00
Jenkins
634004f33e Merge "Add parent field to project creation" 2015-04-30 03:16:20 +00:00
Steve Martinelli
00eeb3593c remove unnecessary conditionals
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
2015-04-19 02:41:04 -04:00
Rodrigo Duarte
2ed0e22049 Add parent field to project creation
Adding the possibility to create projects hierarchies by adding
the parent field in the create project call.

Co-Authored-By: Victor Silva <victor@lsd.ufcg.edu.br>

Implements: bp hierarchical-multitenancy
Change-Id: I4eac4f5bc067634cc38c305dacc59ab1da63c153
2015-03-23 15:45:09 -03:00
Steve Martinelli
dca9978205 Do not allow user to change domain of a project
Keystone Server already surfaces an error for this operation, but
we should restrict the user, and not offer --domain to be changed
for a project.

Change-Id: I48317e8accfea3c285e6ad213e75b783de8070ac
Closes-Bug: #1418384
2015-02-09 15:18:51 +00:00
Steve Martinelli
019c155e9b Fine tune some of the helps commands
try and add some consistency with the show and delete commands.

replace 'show x' with 'display x'
change 'delete a y' with just 'delete y'

Change-Id: I47dfa8ee23ac5c41b355796415eb515155832f65
2015-01-13 00:58:57 -05:00
wanghong
d8f1cbd984 add multi-delete support for identity
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
2014-12-23 09:39:29 +08:00
Jamie Lennox
25a7c1f27f Don't import form keystoneclient.openstack.common
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
2014-12-17 18:17:56 +10:00
Steve Martinelli
13672123fc Safely pop project parent id
Since we don't support multitenancy yet, we should just pop the
parent id of a project. When keystoneclient supports mulittenancy
we should bring everything in at once (CRUD), and these changes
should be removed.

Change-Id: I82c7c825502124a24ccdbadf09ecb2748887ca5d
2014-12-04 15:34:02 -05:00
Steve Martinelli
5bc768bbc2 Add the ability to list projects based on a user
Essentially performing GET /users/{user_id}/projects

Change-Id: Iae6ddfc86a856fa24fbe293ec4af52ea671390f8
Closes-Bug: #1394793
2014-12-01 22:37:08 +00:00
Steve Martinelli
4b239eea42 Add support for domains when deleting identity v3 resources
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
2014-12-01 22:36:54 +00:00
Dean Troyer
04d30c1855 Command object docs: project, role, user
project
role
user
user role

Change-Id: I445e09a3ffb69114912ae562a9285963a636bfd1
2014-12-01 17:36:20 -05:00
Steve Martinelli
79653afa7b Add --or-show support for v3 identity resources
Add --or-show for the following:
  * v3 roles
  * v3 projects
  * v3 domains
  * v3 users
  * v3 groups

Closes-Bug: #1390389
Change-Id: Id4ef043e5fda6be49a515eb3fe138c813c393ec9
2014-11-18 04:58:13 +00:00
Steve Martinelli
a8d4b0eebb Remove 'links' section from several v3 Identity objects
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
2014-10-11 22:35:12 -04:00
Nathan Kinder
f0c57e17c9 Allow --domain to be used for identity commands without lookup
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
2014-10-09 13:29:21 -07:00
Steve Martinelli
364071a90b Add domain parameters to user show for Identity V3
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
2014-10-09 14:34:48 -04:00
Terry Howe
b638488697 Domain administrator cannot do project operations
Domain administrator cannot do project operations because the
require access to the domain API (which they don't have).  When
attempting to find a domain for project operations, ignore errors
because the API returns nothing without indicating there is a
problem.  The domain administrators will have to use a domain id,
but they will still be able to do project operations.  If the user
does not have permission to read the domain table, they cannot
use domain names.

Change-Id: Ieed5d420022a407c8296a0bb3569d9469c89d752
Closes-Bug: #1317478
Closes-Bug: #1317485
2014-07-07 20:18:39 +00:00
Jenkins
3b925e9806 Merge "replace string format arguments with function parameters" 2014-06-10 02:27:54 +00:00
Alex Gaynor
a8087a6c8b Fixed several typos throughout the codebase
Change-Id: I048ee857fc1215fea7f60978364894e1b5abdf66
2014-05-21 07:47:52 -07:00
Christian Berendt
3b485de6b0 replace string format arguments with function parameters
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.

Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
2014-05-20 13:49:56 +02:00
Jamie Lennox
022b6d95d1 Pass arguments to v3 keystoneclient by kwarg
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
2014-04-04 08:09:43 +10:00
Steven Hardy
0c0803d363 identity v3 allow project list filtering by domain
The underlying keystoneclient interface allows filtering by domain,
so support it in the cli interface because it makes project list
much nicer to use in a multi-domain deployment.

Change-Id: If3f5cf1205c1e9cf314f8286a3ae81bda4456b8f
Closes-Bug: #1289513
2014-03-13 09:32:21 +00:00
Terry Howe
70e6333e7d Add ability to set key value pairs in projects
Add supporto of extra key value pairs for projects (aka tenants)
* Added option --property key=value to create and set commands
* Support for versions v2 and v3

Change-Id: I84064b8b308579d1b66c83b1ed3d1a37614ec087
Closes-Bug: #1220280
2014-03-06 14:22:17 -07:00
Dean Troyer
8898e020fb Identity v3 tests
* Add project, user, role and service v3 tests
* Fix issues in commands with enable/disable
* Make commands and tests more consistent between versions
* Make formatting and comments more consistent

Change-Id: Id21e7a5abd7e421a7742f937861ec46b53095fc7
2013-09-09 14:58:28 -05:00
Dean Troyer
dfb0e3e3c1 Begin Python 3 compatability
* 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
2013-07-29 19:12:29 -05:00
Steve Martinelli
1a0d5ccc68 Remove api = apiName calls from each method
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
2013-07-12 11:07:33 -05:00
Monty Taylor
016a0b301e Fix flake8 errors in anticipation of flake8 patch.
Change-Id: Ifdc4322b699f2bd91a6900e55695acd3d736568e
2013-05-14 08:28:48 -07:00
Josh Kearney
b26cb5bf68 Upgraded to PEP8 1.3.3 to stay aligned with Nova, etc.
Made all the necessary changes to pass new PEP8 standards.

Also cleaned up docstrings to conform to the HACKING stanards.

Change-Id: Ib8df3030da7a7885655689ab5da0717748c9edbe
2013-01-31 13:31:41 -06:00
Steve Martinelli
b253534348 v3 identity - group and project api
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
2013-01-28 15:28:32 -06:00