Skip to content

Commit 2148a86

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove use of formatter function"
2 parents ade7da8 + d95e23d commit 2148a86

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

openstackclient/identity/v3/role.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -428,23 +428,22 @@ def take_action(self, parsed_args):
428428
domain = identity_client.find_domain(
429429
name_or_id=parsed_args.domain,
430430
)
431-
columns: tuple[str, ...] = ('ID', 'Name', 'Domain')
432431
data = identity_client.roles(domain_id=domain.id)
432+
return (
433+
('ID', 'Name', 'Domain'),
434+
(
435+
utils.get_item_properties(s, ('id', 'name'))
436+
+ (domain.name,)
437+
for s in data
438+
),
439+
)
440+
433441
else:
434-
columns = ('ID', 'Name')
435442
data = identity_client.roles()
436-
437-
return (
438-
columns,
439-
(
440-
utils.get_item_properties(
441-
s,
442-
columns,
443-
formatters={'Domain': lambda _: domain.name},
444-
)
445-
for s in data
446-
),
447-
)
443+
return (
444+
('ID', 'Name'),
445+
(utils.get_item_properties(s, ('id', 'name')) for s in data),
446+
)
448447

449448

450449
class RemoveRole(command.Command):

0 commit comments

Comments
 (0)