487 Commits

Author SHA1 Message Date
Takashi Kajinami
2e491191e5 Fix ignored --user-domain in role assignment list
Fix the wrong value assignment which made the --user-domain option
ignored. Unit tests are updated to verify usage of domain options to
avoid further regressions.

Also drop the redundant look up of domain id to avoid unnecessary API
call.

Closes-Bug: #2085604
Change-Id: I5112b8e831fb26eb6544615277f0d3fe4f15dc5a
2024-10-29 21:20:07 +09:00
Zuul
8979c00150 Merge "Always resolve domain id" 2024-10-03 11:59:16 +00:00
Takashi Kajinami
c8326b5525 Always resolve domain id
The --user-domain option and the --project-domain option may take id or
name. In case name is given it should be translated to id.

Closes-Bug: 2083390
Change-Id: Idf3f113a74452daabc80660574030cb9b24b1a15
2024-10-01 15:37:27 +00:00
Alfredo Moralejo
52d56b3fd9 identity: in service set command, don't pass the enable option when it is None
Currently, it is passing None value which is not accepted by keystone
parameters validation:

BadRequestException: 400: Client Error for url: ... Invalid input for field 'enabled': None is not of type 'boolean'

Failed validating 'type' in schema['properties']['enabled']:
    {'enum': [True, False, None], 'type': 'boolean'}

On instance['enabled']:
    None

Closes-Bug: #2083021
Change-Id: Ia8772560deb54e71672102157659d4eb22e6ad59
2024-09-30 13:45:03 +02:00
Zuul
2f790c319d Merge "identity: Don't pass unset options when creating user" 2024-09-25 08:22:26 +00:00
Stephen Finucane
033793aa0e identity: Don't pass unset options when creating user
In change I06f3848812bce60c65909f1311f36b70eba427d4, we migrated the
'user *' commands from keystoneclient to SDK. One side effect of this is
that we are no longer able to rely on keystoneclient's 'filter_none'
helper method that filters out parameters that are set to None. As such,
we now need to do this ourselves. Eventually, it would be nice if SDK
provided such functionality itself.

The same change also introduced a bug where the '--domain' argument was
being used to lookup a project rather than the '--project-domain'
argument. This is also corrected.

Change-Id: I1204ca611a74d134c879467d6c2b73f16e043213
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2080600
2024-09-17 13:26:26 +01:00
Antonia Gaete
415f68016c identity: Migrate 'access rule' commands to SDK
Change-Id: Id5740cc61474650f22f9efe8d148c8c666c3b91e
2024-09-17 11:52:46 +01:00
Stephen Finucane
f98006ca9d pre-commit: Migrate pyupgrade to ruff
Change-Id: Ic50d2a5e0bc9dcdfe29f382607135cab510cd396
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-09-12 18:08:23 +01:00
Stephen Finucane
fc6852cd94 pre-commit: Migrate bandit to ruff
The name of the errors change and we need to move things around a
little, but it's otherwise a straight swap.

Change-Id: I0a19765ebeaa14c0534faa1542165b76ed2bf4e2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-09-12 18:08:23 +01:00
Stephen Finucane
519fa7aabc pre-commit: Migrate from black to ruff format
Change-Id: I28ca7d31d30272002799f3e2832105dc67c60538
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-08-29 15:55:39 +01:00
Zuul
0d570cd66a Merge "identity: Use previous naming for 'service show' fields" 2024-08-12 16:01:30 +00:00
Stephen Finucane
25780e80ab identity: Use previous naming for 'service show' fields
We changed these in change I37d07a6c5cdc98680b8d65d596521cad2b049500 but
the '-c/--column' option provided by cliff currently requires an
explicit match on column names. Change them back for now. We can revert
this when cliff is a little bit smarter.

Change-Id: I9180922e9da5c22ae3d8878946d1bf1ec4b8c6e1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2076212
2024-08-08 10:54:10 +01:00
Stephen Finucane
0e731cd22f identity: Use previous naming for 'application credential show' fields
We changed these in change Iba3fee2672d32266623c6f367beaabe84bd3d24e but
the '-c/--column' option provided by cliff currently requires an
explicit match on column names. Change them back for now. We can revert
this when cliff is a little bit cleverer.

Change-Id: I6b4f1b793dc383856bfdf9a01514381be3cd2bf1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Related-bug: #2076212
2024-08-08 10:53:25 +01:00
Zuul
2733b3413d Merge "identity: Migrate 'service' commands to SDK" 2024-07-12 14:07:22 +00:00
Antonia Gaete
bef8a7a630 identity: Migrate 'application credential' commands to SDK
Change-Id: Iba3fee2672d32266623c6f367beaabe84bd3d24e
2024-07-09 15:19:38 +00:00
Antonia Gaete
717f242881 identity: Migrate 'service' commands to SDK
Change-Id: I37d07a6c5cdc98680b8d65d596521cad2b049500
2024-07-09 15:09:37 +00:00
ArtofBugs
de9d0f9e1b Identity: Migrate 'role assignment' commands to SDK
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/913448
Change-Id: I579775d2dc4110951e934e00b51bf8d7546e207b
2024-06-13 16:00:54 -07:00
Stephen Finucane
50c595b6e0 identity: Make better use of argparse
Change-Id: I50d2d28422e609656408b9b59f330d6a78314344
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-05-07 11:20:02 +01:00
Stephen Finucane
c5b772db76 trivial: Prepare for pyupgrade pre-commit hook
This change is entirely automated save for the update of some mocks from
'io.open' to '__builtins__.open').

We are keeping this change separate from addition of the actual hook so
that we can ignore the commit later.

Change-Id: I0a9d8736632084473b57b57b693322447d7be519
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-04-23 12:24:23 +01:00
Zuul
3de6969dbe Merge "tox: Remove bandit skips, run via pre-commit" 2024-05-03 17:36:21 +00:00
Stephen Finucane
0646f9b4e4 tox: Remove bandit skips, run via pre-commit
Most of these skips were unnecessary. The few that did generate warnings
could be skipped.

We also set 'skip_install' since there's no reason to build the package
for linting purposes.

Change-Id: I9644e5c19720b9c41c60e0a5882b7cd7f6a71f7b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-04-26 13:17:15 +01:00
Stephen Finucane
837a3dc015 tests: Fix trivial sorting issue
We've seen an ordering issue pop up occasionally in the CI. Resolve it.

Change-Id: I4dd10268b673c260ac0894fac92cd8bea9e626f4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-04-25 10:34:36 +01:00
ArtofBugs
948b97d09e Identity: Properly list users in a group in 'user list' commands
Change-Id: Ia4457eaea5016b2e0325c6eb704d1592058e455e
2024-04-09 12:15:00 -07:00
ArtofBugs
680e3e3011 identity: Migrate 'user' commands to SDK
Change-Id: I06f3848812bce60c65909f1311f36b70eba427d4
2024-04-04 16:22:56 -07:00
Zuul
f0f811ce4b Merge "[codespell] fix typos in doc,tests and help messages" 2024-01-30 09:34:00 +00:00
Rafael Weingärtner
2ed10e9a72 Introduce schema_version in the federated attribute mapping API
Depends-On: https://review.opendev.org/c/openstack/keystone/+/739966
Change-Id: I276ebd49094368dd823e50ff11a6e65fa2a6dcfb
2024-01-29 08:50:48 -03:00
Rajesh Tailor
71839eb5fa [codespell] fix typos in doc,tests and help messages
Change-Id: I4823782daa1af3872bc22603147e3073152cc777
2023-11-21 11:31:07 +05:30
Jake Yip
b4ba04698b Allow multiple --remove-tag in project set
The help text for this arg says 'repeat option to delete multiple tags'.
Fix to reflect what docs says.

Also add missing test for this argument.

Change-Id: Ib1069ce7a441c1ff10d2dca05095eb6bf53e7fb6
2023-06-08 18:22:48 +10:00
Douglas Mendizábal
bc60e3bb90 Fix "access rule" commands to only use ID
This patch modifies the access rule commands to use only the resource
ID.  The previous logic incorrectly assumed that access rules have a
"name" property, which resulted in unexpected behaviors.

For example, "access rule delete {non-existent-id}" now results in a
"not found" error instead of sometimes deleting an unrelated rule.

Story: 2010775
Task: 48163
Change-Id: Ib5c3b7f86acf1dfe7cc76dfa99fa4c118388bd71
2023-06-05 12:03:15 -04:00
Stephen Finucane
aed521d426 Blacken openstackclient.identity
Black used with the '-l 79 -S' flags.

A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.

Change-Id: I2eeade1ce6653be8e9179ecc40105182c5ff5f16
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-05-10 10:51:30 +01:00
Zuul
36f58c2ad7 Merge "Add authorization_ttl for identity providers" 2022-09-30 12:31:51 +00:00
Zuul
26946d5670 Merge "Add trustor and trustee filtering to trusts list" 2022-09-30 12:23:14 +00:00
Pavlo Shchelokovskyy
167cf11e82 Add authorization_ttl for identity providers
this is supported since Ussuri (Keystone API version 3.14) but was
lacking from openstackclient.

Change-Id: Ifac818b9a4eff66d9a68455ada1ddfe67cb46b3b
2022-07-13 22:28:07 +03:00
Nicolas Belouin
64e4520b2a Add trustor and trustee filtering to trusts list
The keystone API supports filtering trusts by trustor and/or
trustee.

Also adds a shortcut parameter to get trusts with current
user as trustee or trustor.

Signed-off-by: Nicolas Belouin <nicolas.belouin@gandi.net>
Change-Id: I00ed2b68cf8ada214a59f640f4f0a5c9dbc37063
2022-04-12 06:26:18 +00:00
Cyril Roelandt
43639e1118 Fix typos
Change-Id: Idd502c8df21da79ff3b9339870f38378f5337879
2021-10-26 15:53:51 +02:00
Zuul
0fd090eff3 Merge "Add name and enabled param in ListDomain parser" 2020-12-22 13:30:59 +00:00
Stephen Finucane
f5b185c357 Make use of comparable 'FormattableColumn' subclasses
This requires fixes found in cliff 3.5.0 [1] and osc-lib 2.3.0 [2]. With
these fixes in place, we can remove the icky, still broken
'assertItemEqual' and 'assertListItemEqual' helpers.

[1] https://review.opendev.org/761421
[2] https://review.opendev.org/761394

Change-Id: Id6c26b37c3c7d5ec6761361abca57f9219b76838
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-12-09 15:17:25 +00:00
Zuul
c7a43773c9 Merge "Add id and enabled param in ListIdentityProvider parser" 2020-12-01 13:50:56 +00:00
songwenping
c2df9215e1 Remove usage of six
With python3.x, classes can use 'metaclass=' instead of
'six.add_metaclass', 'six.iteritems' and 'six.iterkeys' can
be replaced by 'items' and 'keys', 'six.moves.urllib.parse'
can be replaced by 'urllib.parse', 'six.StringIO' and
'six.moves.cStringIO' can be replaced by 'io.StringIO',
'six.text_type' and 'six.string_type' are just 'str'.

Change-Id: I84848c0bf8ab3c36dd821141191e2725e4e3b58b
2020-10-07 02:15:25 +00:00
Zuul
95cc05bdf6 Merge "Bypass user and group verification in RemoveRole" 2020-08-13 06:29:54 +00:00
Lance Bragstad
e246732670 Bypass user and group verification in RemoveRole
Keystone let's users remove role assignments that reference non-existent
users and groups. This is nice when keystone backs to an identity store
like LDAP and users or groups are removed.

Previously, openstackclient would validate the user and group existed in
keystone before sending the request to delete the role assignment. This
commit updates the code to bypass that validation so that users can use
IDs to forcibly cleanup role assignments.

Change-Id: I102b41677736bbe37a82abaa3c5b3e1faf2475d5
Story: 2006635
Task: 36848
2020-08-12 12:24:17 -05:00
Vishakha Agarwal
1e053babf4 Add id and enabled param in ListIdentityProvider parser
when doing openstack identity provider list --name xyz_id,
and openstack identity provider list --enabled CLI raising
error unrecognized arguments, whereas in api-ref document [1],
user can pass name and enabled as optional query param. This
addresses the above issue, by adding param --id and --enabled in
parser of ListIdentityProvider.

[1] https://docs.openstack.org/api-ref/identity/v3-ext/?expanded=list-identity-providers-detail#list-identity-providers

Change-Id: I59ce3a5f54700ba5a735f0b3b4b3b73b3a8658fa
2020-07-24 19:22:39 +05:30
Roger Luethi
0a8753dc3e Fix reverted osc-lib interface change
The patch https://review.opendev.org/#/c/673389/ introduced a regression
by changing the osc-lib interface.

Two conflicting attempts to fix the regression were launched:

1) Reverting the patch.

2) The patch https://review.opendev.org/683119 changes the exception
   from the generic CommandError back to a specific Forbidden exception.

   The patch https://review.opendev.org/683118 catches this exception
   and passes on, i.e. re-implements the same behavior as before.

The first idea was implemented, the initial patch reverted. The second
idea was partially implemented. The change in python-openstackclient
(683118) was merged. The change in osc-lib was approved but failed to
merge because the initial change had been reverted.

Now we have again a situation where the exception produced in osc-lib
does not match the exception expected by the caller.

It is unclear if the osc-lib interface will ever get a rebased version
of https://review.opendev.org/683119 merged, so the safest way to
address the issue is to also catch the exception that used to be
thrown before the inital change and is again thrown after the inital
change has been reverted.

Change-Id: I2ea2def607ec5be112e42d53a1e660fef0cdd69c
2020-07-23 20:35:21 +02:00
Vishakha Agarwal
8628e52de7 Add name and enabled param in ListDomain parser
when doing openstack domain list --name xyz_id,
and openstack domain list --enabled CLI raising
error unrecognized arguments, whereas in api-ref
document [1], user can pass name and enabled as
optional query param. This addresses the above
issue, by adding param --name and --enabled in
parser of ListDomain.

[1]https://docs.openstack.org/api-ref/identity/v3/?expanded=list-domains-detail#list-domains

Change-Id: I3cdb511d3c7059ddfb802ca025188d8976c9302c
2020-07-21 18:24:58 +05:30
yanpuqing
533af9f1b2 Client should parse string to boolean for value 'is_domain'
When we use "--property" parameter, client get lists these the
value is string type, but the type of the value 'is_domain'
should be boolean, so we should judge it and parse it.
The patch parse string to boolean for value 'is_domain'.

Co-Authored-By: Lance Bragstad <lbragstad@gmail.com>

Change-Id: I37c9eb854524bde3a1530bfe2e3a03810fb1a676
Task: 30039
Story: 2005246
2020-05-29 07:53:13 -05:00
Vishakha Agarwal
7f66273d3f Add resource option immutable
This patch adds the --immutable and --no-immutable option to the
role, project and domain CLI.

Related-Patch: https://review.opendev.org/#/c/712182/

Change-Id: I9c3bdd741f28bf558267fb217818d947597ce13e
2020-04-08 13:51:01 +00:00
Vishakha Agarwal
05da145eae Adding options to user cli
User options [1] can be set by making POST and PATCH
request for /v3/users API calls but cannot by openstack
CLI because of no user options defined in create and update
user CLI [2]. This patch adds the user options [1] in
create user and update user CLI.

[1] https://docs.openstack.org/keystone/latest/admin/resource-options.html#multi-factor-auth-rules
[2] https://docs.openstack.org/api-ref/identity/v3/#create-user

Change-Id: I4e41bae2e8cfbe92d52b14d856991bedcd44164f
2020-03-26 22:24:39 +05:30
Zuul
fc12033f1d Merge "Now we can add description for role creation in OSC" 2020-03-20 18:59:44 +00:00
Colleen Murphy
99b0b07392 Fix copypaste errors in access rule command
Access rules are access rules, not application credentials.

Change-Id: I74d05f11ec186283e5a86d92dcbfe4eb24130eee
2020-01-21 15:08:46 -08:00
Colleen Murphy
70ab3f9dd5 Add support for app cred access rules
This commit introduces the --access-rules option for 'application
credential create' as well as new 'access rule' commands for listing,
showing, and deleting access rules.

bp whitelist-extension-for-app-creds

Change-Id: I04834b2874ec2a70da456a380b5bef03a392effa
2020-01-17 11:14:51 -08:00