|
22 | 22 | import contextlib
|
23 | 23 | import importlib.metadata
|
24 | 24 |
|
25 |
| - |
26 |
| -from pandas import show_versions |
27 | 25 | import tabulate
|
28 | 26 | import requests
|
29 | 27 | import simvue as simvue_client
|
@@ -472,7 +470,7 @@ def get_run_json(run_id: str) -> None:
|
472 | 470 | try:
|
473 | 471 | run: Run = simvue_cli.actions.get_run(run_id)
|
474 | 472 | run_info = run.to_dict()
|
475 |
| - click.echo(json.dumps({k: v for k, v in run_info.items()}, indent=2)) |
| 473 | + click.echo(json.dumps(dict(run_info.items()), indent=2)) |
476 | 474 | except ObjectNotFoundError as e:
|
477 | 475 | error_msg = f"Failed to retrieve run '{run_id}': {e.args[0]}"
|
478 | 476 | click.echo(error_msg, fg="red", bold=True)
|
@@ -699,7 +697,7 @@ def get_alert_json(alert_id: str) -> None:
|
699 | 697 | try:
|
700 | 698 | alert: Alert = simvue_cli.actions.get_alert(alert_id)
|
701 | 699 | alert_info = alert.to_dict()
|
702 |
| - click.echo(json.dumps({k: v for k, v in alert_info.items()}, indent=2)) |
| 700 | + click.echo(json.dumps(dict(alert_info.items()), indent=2)) |
703 | 701 | except ObjectNotFoundError as e:
|
704 | 702 | error_msg = f"Failed to retrieve alert '{alert_id}': {e.args[0]}"
|
705 | 703 | click.echo(error_msg, fg="red", bold=True)
|
@@ -876,7 +874,7 @@ def get_folder_json(folder_id: str) -> None:
|
876 | 874 | try:
|
877 | 875 | folder: Folder = simvue_cli.actions.get_folder(folder_id)
|
878 | 876 | folder_info = folder.to_dict()
|
879 |
| - click.echo(json.dumps({k: v for k, v in folder_info.items()}, indent=2)) |
| 877 | + click.echo(json.dumps(dict(folder_info.items()), indent=2)) |
880 | 878 | except ObjectNotFoundError as e:
|
881 | 879 | error_msg = f"Failed to retrieve folder '{folder_id}': {e.args[0]}"
|
882 | 880 | click.echo(error_msg, fg="red", bold=True)
|
@@ -972,7 +970,7 @@ def get_tag_json(tag_id: str) -> None:
|
972 | 970 | try:
|
973 | 971 | tag: Tag = simvue_cli.actions.get_tag(tag_id)
|
974 | 972 | tag_info = tag.to_dict()
|
975 |
| - click.echo(json.dumps({k: v for k, v in tag_info.items()}, indent=2)) |
| 973 | + click.echo(json.dumps(dict(tag_info.items()), indent=2)) |
976 | 974 | except ObjectNotFoundError as e:
|
977 | 975 | error_msg = f"Failed to retrieve tag '{tag_id}': {e.args[0]}"
|
978 | 976 | click.echo(error_msg, fg="red", bold=True)
|
@@ -1004,7 +1002,7 @@ def get_tenant_json(tenant_id: str) -> None:
|
1004 | 1002 | try:
|
1005 | 1003 | tenant: Tenant = simvue_cli.actions.get_tenant(tenant_id)
|
1006 | 1004 | tenant_info = tenant.to_dict()
|
1007 |
| - click.echo(json.dumps({k: v for k, v in tenant_info.items()}, indent=2)) |
| 1005 | + click.echo(json.dumps(dict(tenant_info.items()), indent=2)) |
1008 | 1006 | except ObjectNotFoundError as e:
|
1009 | 1007 | error_msg = f"Failed to retrieve tenant '{tenant_id}': {e.args[0]}"
|
1010 | 1008 | click.echo(error_msg, fg="red", bold=True)
|
@@ -1169,25 +1167,6 @@ def tenant_list(
|
1169 | 1167 | click.echo(table)
|
1170 | 1168 |
|
1171 | 1169 |
|
1172 |
| -@simvue_tenant.command("json") |
1173 |
| -@click.argument("tenant_id", required=False) |
1174 |
| -def get_tenant_json(tenant_id: str) -> None: |
1175 |
| - """Retrieve tenant information from Simvue server |
1176 |
| -
|
1177 |
| - If no tenant_ID is provided the input is read from stdin |
1178 |
| - """ |
1179 |
| - if not tenant_id: |
1180 |
| - tenant_id = input() |
1181 |
| - |
1182 |
| - try: |
1183 |
| - tenant: Tenant = simvue_cli.actions.get_tenant(tenant_id) |
1184 |
| - tenant_info = tenant.to_dict() |
1185 |
| - click.echo(json.dumps({k: v for k, v in tenant_info.items()}, indent=2)) |
1186 |
| - except ObjectNotFoundError as e: |
1187 |
| - error_msg = f"Failed to retrieve tenant '{tenant_id}': {e.args[0]}" |
1188 |
| - click.echo(error_msg, fg="red", bold=True) |
1189 |
| - |
1190 |
| - |
1191 | 1170 | @admin.group("user")
|
1192 | 1171 | @click.pass_context
|
1193 | 1172 | def user(ctx) -> None:
|
@@ -1293,7 +1272,7 @@ def get_user_json(user_id: str) -> None:
|
1293 | 1272 | try:
|
1294 | 1273 | user: User = simvue_cli.actions.get_user(user_id)
|
1295 | 1274 | user_info = user.to_dict()
|
1296 |
| - click.echo(json.dumps({k: v for k, v in user_info.items()}, indent=2)) |
| 1275 | + click.echo(json.dumps(dict(user_info.items()), indent=2)) |
1297 | 1276 | except ObjectNotFoundError as e:
|
1298 | 1277 | error_msg = f"Failed to retrieve user '{user_id}': {e.args[0]}"
|
1299 | 1278 | click.echo(error_msg, fg="red", bold=True)
|
@@ -1394,25 +1373,6 @@ def delete_user(ctx, user_ids: list[str] | None, interactive: bool) -> None:
|
1394 | 1373 | click.secho(response_message, bold=True, fg="green")
|
1395 | 1374 |
|
1396 | 1375 |
|
1397 |
| -@user.command("json") |
1398 |
| -@click.argument("user_id", required=False) |
1399 |
| -def get_user_json(user_id: str) -> None: |
1400 |
| - """Retrieve user information from Simvue server |
1401 |
| -
|
1402 |
| - If no user_ID is provided the input is read from stdin |
1403 |
| - """ |
1404 |
| - if not user_id: |
1405 |
| - user_id = input() |
1406 |
| - |
1407 |
| - try: |
1408 |
| - user: User = simvue_cli.actions.get_user(user_id) |
1409 |
| - user_info = user.to_dict() |
1410 |
| - click.echo(json.dumps({k: v for k, v in user_info.items()}, indent=2)) |
1411 |
| - except ObjectNotFoundError as e: |
1412 |
| - error_msg = f"Failed to retrieve user '{user_id}': {e.args[0]}" |
1413 |
| - click.echo(error_msg, fg="red", bold=True) |
1414 |
| - |
1415 |
| - |
1416 | 1376 | @simvue.group("storage")
|
1417 | 1377 | @click.pass_context
|
1418 | 1378 | def simvue_storage(ctx):
|
@@ -1495,7 +1455,7 @@ def get_storage_json(ctx, storage_id: str) -> None:
|
1495 | 1455 | try:
|
1496 | 1456 | storage: Storage = simvue_cli.actions.get_storage(storage_id)
|
1497 | 1457 | storage_info = storage.to_dict()
|
1498 |
| - click.echo(json.dumps({k: v for k, v in storage_info.items()}, indent=2)) |
| 1458 | + click.echo(json.dumps(dict(storage_info.items()), indent=2)) |
1499 | 1459 | except ObjectNotFoundError as e:
|
1500 | 1460 | error_msg = f"Failed to retrieve storage '{storage_id}': {e.args[0]}"
|
1501 | 1461 | click.echo(error_msg, fg="red", bold=True)
|
|
0 commit comments