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

view-user: add a new --list-banks optional argument #479

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cmoussa1
Copy link
Member

@cmoussa1 cmoussa1 commented Aug 6, 2024

Problem

Mentioned in #478, there is no concise way to just view a list of banks that a user belongs to without having to parse through the rest of the accounting information associated with it.


This PR adds a new optional argument to view-user called --list-banks, which just outputs a newline-delimited list of banks that a user belongs to.

$ flux account view-user testuser --list-banks
bankA
bankB
bankC

A basic test file is also added which calls this optional argument. For now, this is just built on top of #477, but I can always make it separate in case this gets reviewed first. :-)

Fixes #478

@cmoussa1 cmoussa1 added the new feature new feature label Aug 6, 2024
@cmoussa1 cmoussa1 requested a review from grondo August 6, 2024 23:22
Comment on lines 37 to 39
test_expect_success 'call view-banks --list-banks' '
flux account view-user testuser --list-banks > list_banks.out &&
grep -E "bankA|bankB|bankC" list_banks.out
Copy link
Contributor

@grondo grondo Aug 7, 2024

Choose a reason for hiding this comment

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

Seems to be a tab v space issue here.

Also, should the test check for all of bankA, bankB, bankC, not any of the three? (Which is I think what this is doing now)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry that I didn't catch this earlier! I usually double check this but it slipped through.

I just force-pushed up a change to also just separate the grep check into three different checks for all three banks instead of combining all of them on just one line (that was my misunderstanding of the -E option, sorry!). Can you let me know if you are still seeing that weird output behavior when calling view-user --list-banks? I wasn't able to reproduce that locally (yet) and I tried calling view-user with every optional argument...

Problem: There is no concise way to view the banks that a user belongs
to.

Add a --list-banks optional argument to view-user, which will just print
the banks that a user belongs to in the flux-accounting database.
Problem: There exists no tests for calling view-user with the
--list-banks option.

Add some tests.
@cmoussa1
Copy link
Member Author

cmoussa1 commented Nov 6, 2024

I force-pushed to catch up after #526, but I'm thinking now that flux-accounting has its own formatter class, perhaps I should hold off on getting this PR landed until I restructure view-user to use the new class. Then adding this feature probably becomes cleaner

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

Successfully merging this pull request may close these issues.

view-user: add an option to concisely list banks a user belongs to
2 participants