From 1425d543b0759571877e9b79dc6cc860f0bb8267 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 28 May 2024 15:57:47 +1000 Subject: [PATCH] Added the ability to include logical device properties in the ld ls command via the --properties flag. --- src/python/broker-cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/python/broker-cli.py b/src/python/broker-cli.py index 9ba85829..5d4c9529 100755 --- a/src/python/broker-cli.py +++ b/src/python/broker-cli.py @@ -70,6 +70,7 @@ def str_to_dict(val) -> Dict: ## List logical devices ld_ls_parser = ld_sub_parsers.add_parser('ls', help='list logical devices') +ld_ls_parser.add_argument('--properties', action='store_true', help='Include the properties field in the output', dest='include_props', required=False) ## Create logical devices ld_mk_parser = ld_sub_parsers.add_parser('create', help='create logical device') @@ -294,7 +295,10 @@ def main() -> None: elif args.cmd1 == 'ld': if args.cmd2 == 'ls': devs = dao.get_logical_devices() - tmp_list = list(map(lambda dev: dev.dict(exclude={'properties'}), devs)) + if args.include_props: + tmp_list = list(map(lambda dev: dev.dict(), devs)) + else: + tmp_list = list(map(lambda dev: dev.dict(exclude={'properties'}), devs)) print(pretty_print_json(tmp_list)) elif args.cmd2 == 'create': dev = LogicalDevice.parse_obj(dict_from_file_or_string())