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: make "parsable" spelling consistent #494

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/bindings/python/fluxacct/accounting/user_subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ def create_json_object(conn, user):
return user_info_json


def get_user_rows(conn, user, headers, rows, parseable, json_fmt):
def get_user_rows(conn, user, headers, rows, parsable, json_fmt):
user_str = ""

if parseable is True:
if parsable is True:
# find length of longest column name
col_width = len(sorted(headers, key=len)[-1])

Expand Down Expand Up @@ -285,7 +285,7 @@ def clear_queues(conn, username, bank=None):
# Subcommand Functions #
# #
###############################################################
def view_user(conn, user, parseable=False, json_fmt=False):
def view_user(conn, user, parsable=False, json_fmt=False):
cur = conn.cursor()
try:
# get the information pertaining to a user in the DB
Expand All @@ -295,7 +295,7 @@ def view_user(conn, user, parseable=False, json_fmt=False):
if not result:
raise ValueError(f"User {user} not found in association_table")

user_str = get_user_rows(conn, user, headers, result, parseable, json_fmt)
user_str = get_user_rows(conn, user, headers, result, parsable, json_fmt)

return user_str
# this kind of exception is raised for errors related to the DB's operation,
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/flux-account-service.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def view_user(self, handle, watcher, msg, arg):
val = u.view_user(
self.conn,
msg.payload["username"],
msg.payload["parseable"],
msg.payload["parsable"],
msg.payload["json"],
)

Expand Down
6 changes: 3 additions & 3 deletions src/cmd/flux-account.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ def add_view_user_arg(subparsers):
subparser_view_user.set_defaults(func="view_user")
subparser_view_user.add_argument("username", help="username", metavar=("USERNAME"))
subparser_view_user.add_argument(
"--parseable",
"--parsable",
action="store_const",
const=True,
help="print all information of an association on one line",
metavar="PARSEABLE",
metavar="PARSABLE",
)
subparser_view_user.add_argument(
"--json",
Expand Down Expand Up @@ -652,7 +652,7 @@ def select_accounting_function(args, output_file, parser):
data = {
"path": args.path,
"username": args.username,
"parseable": args.parseable,
"parsable": args.parsable,
"json": args.json,
}
return_val = flux.Flux().rpc("accounting.view_user", data).get()
Expand Down
6 changes: 3 additions & 3 deletions t/t1007-flux-account-users.t
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ test_expect_success 'view some user information' '
grep -w "username: user5011\|userid: 5011\|bank: A" user_info.out
'

test_expect_success 'view some user information with --parseable' '
flux account view-user --parseable user5011 > user_info_parseable.out &&
grep -w "user5011\|5011\|A" user_info_parseable.out
test_expect_success 'view some user information with --parsable' '
flux account view-user --parsable user5011 > user_info_parsable.out &&
grep -w "user5011\|5011\|A" user_info_parsable.out
'

test_expect_success 'view some user information with --json' '
Expand Down
2 changes: 1 addition & 1 deletion t/t1036-hierarchy-small-no-tie-db.t
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test_expect_success 'view database hierarchy' '
test_cmp ${EXPECTED_FILES}/small_no_tie.txt small_no_tie.test
'

test_expect_success 'view database hierarchy in a parseable format' '
test_expect_success 'view database hierarchy in a parsable format' '
flux account view-bank -P root > small_no_tie_parsable.test &&
test_cmp ${EXPECTED_FILES}/small_no_tie_parsable.txt small_no_tie_parsable.test
'
Expand Down
2 changes: 1 addition & 1 deletion t/t1037-hierarchy-small-tie-db.t
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test_expect_success 'view database hierarchy' '
test_cmp ${EXPECTED_FILES}/small_tie.txt small_tie.test
'

test_expect_success 'view database hierarchy in a parseable format' '
test_expect_success 'view database hierarchy in a parsable format' '
flux account view-bank -P root > small_tie_parsable.test &&
test_cmp ${EXPECTED_FILES}/small_tie_parsable.txt small_tie_parsable.test
'
Expand Down
2 changes: 1 addition & 1 deletion t/t1038-hierarchy-small-tie-all-db.t
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test_expect_success 'view database hierarchy' '
test_cmp ${EXPECTED_FILES}/small_tie_all.txt small_tie_all.test
'

test_expect_success 'view database hierarchy in a parseable format' '
test_expect_success 'view database hierarchy in a parsable format' '
flux account view-bank -P root > small_tie_all_parsable.test &&
test_cmp ${EXPECTED_FILES}/small_tie_all_parsable.txt small_tie_all_parsable.test
'
Expand Down
Loading