Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework kci user with new framework #2141

Merged
merged 3 commits into from
Nov 1, 2023

Conversation

gctucker
Copy link
Contributor

@gctucker gctucker commented Oct 20, 2023

Implement parts of kci user with the new framework based on Click and remove the corresponding old implementation code.

@gctucker gctucker mentioned this pull request Oct 20, 2023
40 tasks
@gctucker gctucker force-pushed the kci-user-rework branch 3 times, most recently from f7a51b0 to 987b6e1 Compare October 24, 2023 10:57
@gctucker gctucker marked this pull request as draft October 24, 2023 10:57
@gctucker gctucker force-pushed the kci-user-rework branch 4 times, most recently from 9d37726 to 5f2e150 Compare October 29, 2023 08:00
@JenySadadia
Copy link
Collaborator

@gctucker Is this ready for review?
It would be good to merge these changes before I update user-related API bindings with fastapi-users integration.

@gctucker gctucker marked this pull request as ready for review October 31, 2023 12:48
@gctucker
Copy link
Contributor Author

@gctucker Is this ready for review?

It is now I've rebased it ;)

Add a first implementation of 'kci user' with just the whoami command
moved from the top-level kci script.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Implement the main parts of the `kci user` subcommand with whoami,
find, token, password update / add.

Some missing features on the API side mean we can't yet implement
update, activate, deactivate and password reset.  Also the token
expiry date can't yet be specified.  These things will need to be
implemented as follow-ups when the features become available.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Remove the parts of the old `kci user` implementation that have now
been implemented again with Click.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
kci
Comment on lines 18 to 21
from kernelci.cli import ( # pylint: disable=unused-import
docker as kci_docker,
user as kci_user,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are unused imports.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it is required to register sub-commands. A comment about it would have been helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's quite implicit, which is nice in a way as it means no additional code is required but it's against the Zen of Python. I'll add some comments there.

Copy link
Collaborator

@JenySadadia JenySadadia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested OK with early-access instance.

@JenySadadia JenySadadia added this pull request to the merge queue Nov 1, 2023
Merged via the queue into kernelci:main with commit 38189c2 Nov 1, 2023
4 checks passed
@gctucker gctucker deleted the kci-user-rework branch November 1, 2023 14:04
Comment on lines +70 to +72
@kci_user.group(name='password')
def user_password():
"""Manage user passwords"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I added sub-commands to this group, it became kci user password reset-password.
I expected it to be kci password reset-password.
What are the benefits of adding groups?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this was as per the proposed syntax on the GitHub discussion:
kernelci/kernelci-project#263 (comment)

It means all the user-related commands are grouped under kci user. There might be other passwords for other things, like kci storage password or anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants