425 Commits

Author SHA1 Message Date
Zuul
ea2e6d6bfb Merge "Modify the help message for 'registered limit set'" 2018-12-18 07:17:25 +00:00
Vishakha Agarwal
eb06a24e4f Modify the help message for 'registered limit set'
Regsitered limit set CLI takes --service, --region and
--resource-name as param which can be updated along with
--default limit for existing registered limit.

Default limit can be updated with same value and CLI
return the success. But --service, --region and --resource-
name cannot be same as existing one. CLI return 409
for this case. Which is valid behaviour because more than
one limit with same service and same resource cannot exist.

But help message of --service, --region and --resource-name
are not much clear to tell that they cannot be passed with
same value.

This patch clarifies the help message for resigtered limit set CLI.

Reference Scenario:
*  openstack registered limit set --default-limit 91 64c2e97fbe904b888544ffdcab21989b
limit updated sucessfully

Updating limit with exsiting service and resource-name:

* openstack registered limit set --default-limit 92 --resource-name snapshot 64c2e97fbe904b888544ffdcab21989b
Conflict occurred attempting to store registered_limit - Duplicate entry. (HTTP 409)

*openstack registered limit set --default-limit 93 --service compute 64c2e97fbe904b888544ffdcab21989b
Conflict occurred attempting to store registered_limit - Duplicate entry. (HTTP 409)

*openstack registered limit set --default-limit 91 --resource-name snapshot --service glance 64c2e97fbe904b888544ffdcab21989b
Conflict occurred attempting to store registered_limit - Duplicate entry. (HTTP 409)

Change-Id: I9e78a6250567cd981adde96946818bb016760a49
2018-11-09 08:15:40 +05:30
Vishakha Agarwal
81fd5c995d Updated the take_actions for unified limits
When user passes --region None, the find_resource
of osc_lib calls get() of region. The get API of
region ignores the name param returning all the
regions in result. As the find_resource checks
many cases against the result returned by get API.
The output comes greater than 1, thus returning
"More than one region ID exist" which is incorrect.
However in case of region which cannot be filtered
by name we do not require to check these many cases.

The solution is to directly call the get method of
APIs and returning No resource name exist with the
xyz" on passing invaid parameter. And returning all
in case of None.

Thus created a new function get_resource which can
be used in future too by these types of API's.

Change-Id: Ib3f881d34a82af97199ce51bfbefc6f3f08599f1
Closes-bug: #1799153
2018-11-09 07:53:55 +05:30
Vishakha Agarwal
0d764cdb5a Add project param in LimitList parser
when doing openstack limit list --project xyz_id,
CLI raising error unrecognized arguments, whereas
in api-ref document [1], user can pass project_id
as query param.This addresses the above issue, by
adding param --project in parser of LimitList.

[1] https://developer.openstack.org/api-ref/identity/v3/index.html

Change-Id: If4644cc99a3803f61f4a688b828aeb73977fc0dd
Closes-Bug: #1798744
2018-11-08 11:19:24 -06:00
Julie Pichon
91a2d88862 Allow endpoint filtering on both project and project-domain
The --project and --project-domain flags are currently mutually
exclusive for listing endpoints, however the --project-domain argument
is supposed to help with filtering projects with colliding names. They
should be allowed together.

Story: 2004018
Task: 27007
Change-Id: I7340e01f509e3515f07cb46f175fb603f1ce8b67
2018-10-09 13:23:49 +00:00
Lance Bragstad
735896eb1a Implement support for project limits
This commit let's users manage limits via the command line.

bp unified-limits

Change-Id: I7c44bbb60557378b66c5c43a7ba917f40dc2b633
2018-07-23 21:52:00 +00:00
Lance Bragstad
641a4faac1 Implement support for registered limits
This commit adds support for users to manage registered limits via
the command line.

bp unified-limits

Depends-On: https://review.openstack.org/#/c/574391/
Change-Id: Id8377363f7a3248b45aeeba21d2acc02684a0305
2018-07-23 21:18:50 +00:00
Sami MAKKI
08dbd154e5 Fix the role implies list command.
The code was calling an unexisting function which never existed.
The module refers now to the correct `InferenceRuleManager`. It
also allows the compatibility with the future python-keystoneclient
in which the compatibility method will be removed from the
RoleManager.

Change-Id: I08f785dc9e840da2e16915683eecfe49189c44b3
2018-06-24 02:17:02 +02:00
Lance Bragstad
8bfa180430 Add system role functionality
This commit adds the necessary bits to expose system role
assignments to openstackclient via python-keystoneclient.

bp system-scope

Depends-On: Iecbcbf020a15f2bec777334c648d4477f89f3b2c
Change-Id: I261e84700b51e8715eaebdc3f8f8bc46b68542c2
2018-06-04 20:09:14 +00:00
Sean McGinnis
d601415259 Clean up W503 and E402 pep8 errors
pycodestyle 2.40 and later enforce these rules that were not previously
enforced. Rather than just skipping them, this cleans up the trivial
instances of these violations.

This does also include some other updates that were not triggering errors
in an attempt to keep some of the style consistent.

Change-Id: Id7c0a6b8f1f835e69d844b000e3ed751852ada63
Closes-bug: #1762803
2018-04-15 12:23:06 +09:00
Zuul
f21b0a073f Merge "Fix additional output encoding issues" 2018-03-29 04:23:16 +00:00
Dean Troyer
6df58b6366 Fix additional output encoding issues
This is a followup to https://review.openstack.org/#/c/541609/ that
changes most outstanding direct uses of sys.stdout to use the encoded
stdout set up by cliff.

Change-Id: I07cfc418385fc787d3b7d3c32d39676cf81bb91f
2018-03-20 15:40:23 -05:00
Zuul
e78c9bc00d Merge "Add CRUD support for application credentials" 2018-03-14 02:16:35 +00:00
Zuul
c24451e19c Merge "Add support for endpoint group commands" 2018-02-25 01:05:18 +00:00
Jose Castro Leon
1eae301c4f Add support for endpoint group commands
Implements the commands for endpoint group filter management.
Includes the CRUD management of the endpoint groups and the
association management between them and the projects that are
using this method.

Implements: blueprint keystone-endpoint-filter
Change-Id: I4265f7f8598d028191e90d76781b7b6ece6fef64
2018-02-23 20:36:04 +00:00
Gage Hugo
d32664150f Add project tags functionality
This change adds tags functionality for projects in keystone. A user
can add a single tag with "--tag", chain "--tag" to add multiple
tags, or clear tags with "--no-tag".

Change-Id: I31cfef3e76dcefe299dacb00c11bb1a10a252628
Partially-Implements: bp project-tags
2018-02-23 20:26:57 +00:00
Colleen Murphy
375964f270 Add CRUD support for application credentials
Add support for creating, retrieving, and deleting application
credentials. Application credentials do not support updates.

In order to provide a positive user experience for the `--role` option,
this patch also includes an improvement to the
`identity.common._get_token_resource()` function that allows it to
introspect the roles list within a token. This way there is no need to
make a request to keystone to retrieve a role object, which would fail
most of the time anyway due to keystone's default policy prohibiting
unprivileged users from retrieving roles.

bp application-credentials

Change-Id: I29e03b72acd931305cbdac5a9ff666854d05c6d7
2018-01-30 21:50:01 +01:00
Zuul
21b656ca4a Merge "Add support for endpoing filter commands" 2017-12-13 02:18:43 +00:00
Jose Castro Leon
12ee186108 Add support for endpoing filter commands
Implements the commands that allow to link and endpoint to
a project for endpoint filter management.

Implements: blueprint keystone-endpoint-filter

Change-Id: Iecf61495664fb8413d35ef69f07ea929d190d002
2017-11-21 07:58:48 +01:00
yangweiwei
0f749cacc2 Fix credentials in create, update and list.
Now, keystone has supported serverl auth method, like 'totp'.
Before we use this method, we should create the credential first.
And we need create it with type 'totp'. But now we cannot create
credential with this method.

Also, I think the type should not have constrains. We can create
any type in keystone project. So, we should do these actions too.
The type would be more which We cannot control.

Change-Id: Ie0482da3133fb515e4bb8e45f8c54f509589cc5e
Closes-bug: #1731848
2017-11-17 11:39:15 +08:00
Anton Frolov
f6f5ce03c5 Optimize getting endpoint list
Currently ListEndpoint.take_action method unconditionally iterates
over all endpoints and issue GET /v3/services/<ep.service_id>
request for each endpoint. In case of HTTPS keystone endpoint this
can take significant amout of time, and it only getting worse in
case of multiple regions.

This commit change this logic to making just two GET requests: first
it gets endpoint list, then it gets service list, searching service
in the list instead of issuing GET /v3/services/<id> request.

Change-Id: I22b61c0b45b0205a2f5a4608c2473cb7814fe3cf
Closes-Bug: 1719413
2017-09-26 14:31:07 -07:00
Harry Rybacki
8cd3e258c5 Implied Roles
Allow the user to create an inference rule between
two roles. The first, called the prior role
is the role explicitly assigned to an individual.
The second, called the implied role, is one that
the user gets implicitly. For example:

Role B implies Role A.
User X is assigned Role B.
Therefore User X also assigned Role A.

The management and maintenance of the rules is
performed in the Keystone server.

Change-Id: If547c2f16e812bc7fffd742ec37e6a26011f3185
2017-08-22 17:08:30 +00:00
Jenkins
86bda36963 Merge "Use *_as_ids instead *_as_list" 2017-07-26 03:58:57 +00:00
zhanghongtao
470a1f1acf Add optional parameter "user_id" and "type" to list credentials
In keystone version 3.5, "type" optional attribute has been added
to list credentials. This patch add "user_id" and "type" optional
parameter in openstack client.

Change-Id: Ia09ee7c39204fdff2dfd7b9b606d888d007caac5
2017-07-25 09:56:50 -05:00
Kristi Nikolla
77ff011ced Add domain parameter to Identity Provider
Identity providers are now associated with domains. This change
allows a user to specify a domain by ID or by name when creating
an identity provider. [0]

This also adds the column for Domain ID in listing.
Updating a domain for an identity provider is not supported, so
that isn't changed.

[0]. Id18b8b2fe853b97631bc990df8188ed64a6e1275

Closes-Bug: 1698390

Change-Id: Icc408e2fe88f257d5863bd3df716a777d52befcc
2017-07-21 11:28:57 -04:00
jiangpch
a01bf55d20 Fix 'domain' filter not work well in some commands
The 'domain' filter not work well in commands 'project show',
'user show' and 'user set'.

Depends-On: I490900d6249f01654d4cba43bddd3e7af7928a84
Closes-Bug: #1704097
Change-Id: Ib4f47cbaba27eb56c4a41d187fee74a995e62dc7
2017-07-18 23:01:22 +00:00
Kristi Nikolla
da53c2b334 When creating a trust, send role_ids instead or role_names
This changes create a trust to use ids instead of names because of
the possibility of roles sharing a name. Even if the user
uniquely identified a role by inputting the id, the request sent
to the identity service would used the name, therefore the command
would fail in the case that two roles share a name.

This does not change how trusts are displayed during trust list or
trust show, a name will still be shown instead of an id.

Depends-On: I38e0ac35946ee6e53128babac3ea759a380572e0

Change-Id: I5bdf89f1e288954a7f5c2704231f270bc7d196f5
Closes-Bug: 1696111
2017-06-22 17:08:01 +00:00
David Rabel
0ad6b6b2e0 Use _get_token_resource in role assignment list
If project matches the project from access token,
we do not have to send an API request to /projects?name=...,
because the project ID is already known.
This API request may require additional permissions, so
we want to avoid it, if possible.

Change-Id: Ice1af8686bceea6b67229dcab7cf82eef821163e
Closes-Bug: #1658189
2017-05-23 17:16:41 +02:00
Huanxuan Ao
ef5a7caf85 Support to add/remove multi users for "group add/remove user"
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
2017-03-21 10:39:42 +08:00
adrian-turjak
49f6032b69 Non-Admin can't list own projects
Due to a default Keystone policy until Newtown,
and the use of resource_find, non-admins are unable
to list their own projects.

This patch bypasses this problem while also introducing better
UX for non-admins wishing to get their project list.

'openstack project list' retains the default of 'list all projects'
but on a forbidden error will default instead to 'list my projects'.
This way for non-admins 'list my projects' feels like the default
without breaking the expected admin default.

Adding the '--my-projects' option allows admins to easily list their
own projects or allows non-admins to be explicit and bypass the
forbidden error fallback.

Change-Id: I1021276f69fbbf28e13e17c4e567d932fce7ed8b
Closes-Bug: #1627555
2017-03-20 14:40:56 +13:00
Jenkins
3d4750cdc8 Merge "Narrow expected responses for CheckUserInGroup" 2017-03-16 13:02:02 +00:00
Jenkins
9184e19288 Merge "Add sort support to project list" 2017-03-16 13:01:56 +00:00
Colleen Murphy
853ea5ab59 Narrow expected responses for CheckUserInGroup
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
2017-03-14 09:23:19 +01:00
Tom Jose Kalapura
6c1b03bf73 Add sort support to project list
Add sort support to project list by sorting items in the client side.
By default list will be sorted by name.

Change-Id: I00011406846b4003aff075eeeb88ac18fa5e2820
Closes-Bug: #1596818
2017-03-08 08:47:35 -08:00
Rodrigo Duarte Sousa
a98d369a39 Use *_as_ids instead *_as_list
The parents_as_list and subtree_as_list query parameters limit the
result to only parents and subtree where the user making the call has
role assignments in. Since OSC only displays the IDs, the call would be
the same as the similar *_as_ids queries, the difference is that the
later doesn't enforce the role assignments (making it more useful).

Output example by using this patch:

$ openstack project show --children root
+-------------+------------------------------+
| Field       | Value                        |
+-------------+------------------------------+
| description |                              |
| domain_id   | default                      |
| enabled     | True                         |
| id          | 123                          |
| is_domain   | False                        |
| name        | root                         |
| parent_id   | default                      |
| subtree     | {u'456': None, u'789': None} |
+-------------+------------------------------+

Change-Id: Ib7b37ae8f55190a7efcc375d5be4a2823d02d1a4
2017-03-01 23:24:11 -03:00
Rui Chen
c828216e2b Fix "endpoint list" help message
OSC support to filter OpenStack endpoints by service type, name and ID,
but help message and document don't contain "type" for "--service"
option of "endpoint list" command.

Change-Id: I5c8bc28e037b4c6f96ec83525a319353f01f256a
Closes-Bug: #1666841
2017-02-22 17:56:03 +08:00
Jenkins
3b562ffa90 Merge "Handle log message interpolation by the logger in identity/" 2017-02-14 08:23:21 +00:00
Jenkins
2cb1cee361 Merge "Modify error handling for role and group commands" 2017-02-13 17:27:33 +00:00
Gábor Antal
335c8d3ef3 Handle log message interpolation by the logger in identity/
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: I1d6588093616099a9eef0947c09e038b9e53493a
Related-Bug: #1596829
2017-02-13 17:38:30 +01:00
Huanxuan Ao
cfd4e2a722 Modify error handling for role and group commands
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
2017-02-09 19:49:55 +08:00
Rui Chen
4679a4c193 Fix --parents and --children options in project show
Options "--parents" and "--children" don't work in "project show"
command, fix the issue and add related unit and functional tests.

Change-Id: Id9965267a037442f1077f8e1929d0527981f643d
Closes-Bug: #1499657
2017-02-09 19:24:55 +08:00
Jenkins
029b389cf8 Merge "Adds domain specification for SetUser" 2017-01-26 03:01:10 +00:00
Samuel Pilla
4cb56269ad Adds domain specification for SetUser
This patch adds the ability to specify the domain context for making
changes to a user with `--domain` flag.

Example:
$ openstack user set test_user --domain test_domain --enable

Change-Id: I2b3241785c22e72e19181394acff650422299b0e
Closes-Bug: #1658147
2017-01-25 22:16:22 +00:00
Colleen Murphy
365d839a5b Fix 'mapping set' return value
Without this patch, the command 'openstack mapping set <args>' will,
upon success, print the rules for the updated mapping and exit with
return code 1 (failure). This is a problem for scripts and config
management tools that depend on the return code to validate whether the
operation was successful, since even upon success the command returns a
failing error code. Moreover, the behavior of printing the new value is
completely unlike the behavior of any of the 'set' subcommands for
other entities. This patch normalizes the 'mapping set' command by
omitting any return value in the SetMapping take_action() method. This
way the client will only exit with an error code if an exception is
raised, and not upon normal operation.

Change-Id: I610ec3b2fa7561072346d46e49cfc1ae82130e0d
2017-01-25 18:07:17 +01:00
Jenkins
c9de2d67e9 Merge "Handle 403 error on creating trust" 2017-01-24 04:16:28 +00:00
Hongbin Lu
5cf77bb672 Handle 403 error on creating trust
Currently, creating trust requires permission to list roles, but
non-admin users don't have permission to do that by default. This
commit adds exception handling on listing roles, and continue to
create trust if server returns 403.

Closes-Bug: #1658582
Change-Id: I4f016b76cb46ae07ef65ed54780881bbcd6210d3
2017-01-24 01:50:36 +00:00
Huanxuan Ao
96578cb8ab Error handling for delete commands in identity
Add missing multi deletion error handling for
identity delete commands.
All delete commands in identity support
error handling now.

Change-Id: I05626dcb5e516a423d610906347b02236ba7eeaf
2017-01-03 23:30:49 +08:00
Colleen Murphy
5203cc9707 Remove auth_with_unscoped_saml decorator
The auth_with_unscoped_saml decorator existed to make sure the user
selected the right auth plugin before trying to call either a
'federation domain' or 'federation project' command. This is outdated,
because openstackclient now uses keystoneauth[1] and keystoneauth
removed its entrypoints for the federation plugins[2] since its
_Rescoped class no longer needs them. This patch removes the decorator
since that validation check was the only thing standing in the way of
the commands working correctly. Also removed the '*_list_wrong_auth'
tests since those only existed to test the decorator, and stopped
setting the plugin in the positive tests since the
automatically-determined token plugin should now be fine.

[1] http://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=6ae0d2e8a54fd5139e63a990ab4bdce634e73c5e
[2] http://git.openstack.org/cgit/openstack/keystoneauth/commit/?id=d9e4d26bb86f8d48e43188b88bab9d7fe778d2c1

Change-Id: Id981739663113447a7bba8ddba81ba9394a19e07
Closes-bug: #1624115
2016-12-04 18:59:09 +00:00
zhiyong.dai
82b96f57db TrivialFix in helpMessage for readability
Change-Id: Ic5fae89455470585f1bd79539f99a9c04e0c68a0
2016-11-23 02:58:26 +08:00
Steve Martinelli
0ef8535036 translate all command help strings
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
2016-11-17 02:33:42 +00:00