Make better use of argparse and eliminate the need for a helper in the
process.
Change-Id: Ibdc9b4bfbb4d532ddb05bce9b49bcf0580cce76d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This patch fixes a bug where the 'options' field was missing from
the output of the 'openstack user show' command since v7.0.0.
The issue was caused by the 'options' field not being included in
the column list in the _format_user function. This field is important
as it contains various user settings such as multi-factor authentication
configurations and password policy exemptions.
This patch:
1. Adds 'options' field to the column list in _format_user function
2. Updates all affected unit tests to include this field
3. Uses getattr() to safely handle cases where the options field may be absent
Without this fix, users cannot see important options like multi-factor
authentication settings through the CLI, which could lead to security
configuration issues being overlooked.
Closes-Bug: #2084946
Change-Id: I4319268ad4310e6164eb8e65664d73f9b32cdd78
cliff is now smarter (I9155763eee15e19eab23b48989dfcc19ea2c5d34), so we
can effectively revert change I6b4f1b793dc383856bfdf9a01514381be3cd2bf1.
We bump the dependencies to ensure this.
Change-Id: I2af19043fd66b5be0826a774baeabeac7110a4aa
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
When creating a user with the --password-prompt option, a warning is
incorrectly displayed stating that no password was supplied, even though
a password was entered. This occurs because the code checks parsed_args.password
instead of the password variable that actually stores the prompted password.
This patch fixes the issue by checking the 'password' variable
instead of 'parsed_args.password' in the warning condition. A test
case has been added to verify that no warning is displayed when
using --password-prompt and entering a password.
Closes-Bug: #2091836
Change-Id: Ib3ddc7e400ee7988f605c00db534bccc3617d982
One has been introduced since Ie5907de8d60f2f39e98f6a88227cebb2e2ff565c
merged.
Change-Id: I37f7bf58a2cbecb69b370e832e56daa310cea3b6
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
The values of these dictionaries are not used when SDK is in use,
which should soon account for all use cases. Eventually we should
probably look for plugins to return a proper class or typeddict but
that's a job for another day.
This began as a fix for in openstackclient/object/client.py which
referenced a non-existent class and quickly snowballed.
Change-Id: I7b807ec3a97124b35828ffdecbb36f6fde11e7b5
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
The fix ensures that if a user wants to set a default project,
they must also provide the project domain. If it's missing,
an explicit error message is shown, making it clear that the
project domain is required.
Also adding some unit tests by modifying respective calls.
Change-Id: Ia6e921a53da55ab1bce85a42c8160872a9d47d64
Closes-Bug: #2102146
openstacksdk's Credential expects user_id and project_id, not user and
project. Previously, we would send payloads like
{'type': 'ec2', 'blob': '{"access": "s3-user1", "secret": "s3-secret1"}'}
which Keystone would reject with
'user_id' is a required property
Change-Id: I0544bef7df9247395f0726ea075112d6ac992252
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
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
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
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