lager-cli 0.59.0__tar.gz → 0.61.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. {lager_cli-0.59.0/lager_cli.egg-info → lager_cli-0.61.0}/PKG-INFO +1 -1
  2. {lager_cli-0.59.0 → lager_cli-0.61.0}/__init__.py +1 -1
  3. {lager_cli-0.59.0 → lager_cli-0.61.0}/box_storage.py +35 -0
  4. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/diagnose.py +5 -1
  5. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/drivers.py +73 -4
  6. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/nets.py +2 -0
  7. lager_cli-0.61.0/commands/communication/wifi.py +405 -0
  8. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/arm.py +41 -16
  9. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/debug/commands.py +53 -16
  10. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/scope.py +1 -1
  11. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/update.py +146 -11
  12. {lager_cli-0.59.0 → lager_cli-0.61.0}/context/session.py +5 -3
  13. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/net_group.py +57 -1
  14. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/scripts/setup_and_deploy_box.sh +6 -1
  15. {lager_cli-0.59.0 → lager_cli-0.61.0}/gateway_auth.py +45 -2
  16. {lager_cli-0.59.0 → lager_cli-0.61.0}/impl/measurement/scope.py +10 -0
  17. {lager_cli-0.59.0 → lager_cli-0.61.0}/impl/measurement/scope_stream.py +51 -10
  18. {lager_cli-0.59.0 → lager_cli-0.61.0/lager_cli.egg-info}/PKG-INFO +1 -1
  19. lager_cli-0.59.0/commands/communication/wifi.py +0 -210
  20. {lager_cli-0.59.0 → lager_cli-0.61.0}/LICENSE +0 -0
  21. {lager_cli-0.59.0 → lager_cli-0.61.0}/MANIFEST.in +0 -0
  22. {lager_cli-0.59.0 → lager_cli-0.61.0}/NOTICE +0 -0
  23. {lager_cli-0.59.0 → lager_cli-0.61.0}/README.md +0 -0
  24. {lager_cli-0.59.0 → lager_cli-0.61.0}/__main__.py +0 -0
  25. {lager_cli-0.59.0 → lager_cli-0.61.0}/address_utils.py +0 -0
  26. {lager_cli-0.59.0 → lager_cli-0.61.0}/battery/__init__.py +0 -0
  27. {lager_cli-0.59.0 → lager_cli-0.61.0}/battery/battery_tui.py +0 -0
  28. {lager_cli-0.59.0 → lager_cli-0.61.0}/battery/websocket_client.py +0 -0
  29. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/__init__.py +0 -0
  30. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/__init__.py +0 -0
  31. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/_device_identity.py +0 -0
  32. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/_gateway.py +0 -0
  33. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/_host_ops.py +0 -0
  34. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/_mount_prep.py +0 -0
  35. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/_net_preflight.py +0 -0
  36. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/_pip_validation.py +0 -0
  37. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/_shim_verbs.py +0 -0
  38. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/_ssh.py +0 -0
  39. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/bench.py +0 -0
  40. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/box_group.py +0 -0
  41. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/boxes.py +0 -0
  42. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/config.py +0 -0
  43. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/dut.py +0 -0
  44. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/hello.py +0 -0
  45. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/instruments.py +0 -0
  46. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/labjack_pins.py +0 -0
  47. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/lock.py +0 -0
  48. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/net_tui.py +0 -0
  49. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/ssh.py +0 -0
  50. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/box/ssh_setup.py +0 -0
  51. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/__init__.py +0 -0
  52. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/ble.py +0 -0
  53. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/blufi.py +0 -0
  54. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/i2c.py +0 -0
  55. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/router.py +0 -0
  56. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/spi.py +0 -0
  57. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/uart.py +0 -0
  58. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/usb.py +0 -0
  59. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/communication/websocket_client.py +0 -0
  60. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/custom.py +0 -0
  61. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/__init__.py +0 -0
  62. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/debug/__init__.py +0 -0
  63. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/debug/net_cache.py +0 -0
  64. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/debug/rtt_websocket_client.py +0 -0
  65. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/debug/service_client.py +0 -0
  66. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/debug/service_helper.py +0 -0
  67. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/debug/tunnel.py +0 -0
  68. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/devenv.py +0 -0
  69. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/development/python.py +0 -0
  70. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/__init__.py +0 -0
  71. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/adc.py +0 -0
  72. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/dac.py +0 -0
  73. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/energy.py +0 -0
  74. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/gpi.py +0 -0
  75. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/gpo.py +0 -0
  76. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/logic.py +0 -0
  77. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/thermocouple.py +0 -0
  78. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/measurement/watt.py +0 -0
  79. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/power/__init__.py +0 -0
  80. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/power/battery.py +0 -0
  81. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/power/battery_model_csv.py +0 -0
  82. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/power/eload.py +0 -0
  83. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/power/solar.py +0 -0
  84. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/power/supply.py +0 -0
  85. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/security/__init__.py +0 -0
  86. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/security/hsm.py +0 -0
  87. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/__init__.py +0 -0
  88. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/_host_cli.py +0 -0
  89. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/binaries.py +0 -0
  90. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/defaults.py +0 -0
  91. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/exec_.py +0 -0
  92. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/install.py +0 -0
  93. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/install_wheel.py +0 -0
  94. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/login.py +0 -0
  95. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/logs.py +0 -0
  96. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/uninstall.py +0 -0
  97. {lager_cli-0.59.0 → lager_cli-0.61.0}/commands/utility/webcam.py +0 -0
  98. {lager_cli-0.59.0 → lager_cli-0.61.0}/config.py +0 -0
  99. {lager_cli-0.59.0 → lager_cli-0.61.0}/context/__init__.py +0 -0
  100. {lager_cli-0.59.0 → lager_cli-0.61.0}/context/ci_detection.py +0 -0
  101. {lager_cli-0.59.0 → lager_cli-0.61.0}/context/constants.py +0 -0
  102. {lager_cli-0.59.0 → lager_cli-0.61.0}/context/core.py +0 -0
  103. {lager_cli-0.59.0 → lager_cli-0.61.0}/context/error_handlers.py +0 -0
  104. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/__init__.py +0 -0
  105. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/custom_drivers.py +0 -0
  106. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/group_usage.py +0 -0
  107. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/matchers.py +0 -0
  108. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/net_helpers.py +0 -0
  109. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/net_storage.py +0 -0
  110. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/param_types.py +0 -0
  111. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/ssh_utils.py +0 -0
  112. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/tui_keys.py +0 -0
  113. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/tui_ws_bridge.py +0 -0
  114. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/utils.py +0 -0
  115. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/version_skew.py +0 -0
  116. {lager_cli-0.59.0 → lager_cli-0.61.0}/core/ws_diagnose.py +0 -0
  117. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/__init__.py +0 -0
  118. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/scripts/__init__.py +0 -0
  119. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/scripts/configure_docker_dns.py +0 -0
  120. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/scripts/configure_docker_dns.sh +0 -0
  121. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/scripts/convert_to_sparse_checkout.sh +0 -0
  122. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/scripts/setup_ssh_key.sh +0 -0
  123. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/security/__init__.py +0 -0
  124. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/security/etc_lager_perms.sh +0 -0
  125. {lager_cli-0.59.0 → lager_cli-0.61.0}/deployment/security/secure_box_firewall.sh +0 -0
  126. {lager_cli-0.59.0 → lager_cli-0.61.0}/errors.py +0 -0
  127. {lager_cli-0.59.0 → lager_cli-0.61.0}/exceptions.py +0 -0
  128. {lager_cli-0.59.0 → lager_cli-0.61.0}/gateway_tunnel.py +0 -0
  129. {lager_cli-0.59.0 → lager_cli-0.61.0}/impl/__init__.py +0 -0
  130. {lager_cli-0.59.0 → lager_cli-0.61.0}/impl/box_config.py +0 -0
  131. {lager_cli-0.59.0 → lager_cli-0.61.0}/impl/measurement/__init__.py +0 -0
  132. {lager_cli-0.59.0 → lager_cli-0.61.0}/impl/power/__init__.py +0 -0
  133. {lager_cli-0.59.0 → lager_cli-0.61.0}/impl/power/enable_disable.py +0 -0
  134. {lager_cli-0.59.0 → lager_cli-0.61.0}/lager_cli.egg-info/SOURCES.txt +0 -0
  135. {lager_cli-0.59.0 → lager_cli-0.61.0}/lager_cli.egg-info/dependency_links.txt +0 -0
  136. {lager_cli-0.59.0 → lager_cli-0.61.0}/lager_cli.egg-info/entry_points.txt +0 -0
  137. {lager_cli-0.59.0 → lager_cli-0.61.0}/lager_cli.egg-info/requires.txt +0 -0
  138. {lager_cli-0.59.0 → lager_cli-0.61.0}/lager_cli.egg-info/top_level.txt +0 -0
  139. {lager_cli-0.59.0 → lager_cli-0.61.0}/main.py +0 -0
  140. {lager_cli-0.59.0 → lager_cli-0.61.0}/pyproject.toml +0 -0
  141. {lager_cli-0.59.0 → lager_cli-0.61.0}/run_record.py +0 -0
  142. {lager_cli-0.59.0 → lager_cli-0.61.0}/safe_unpickle.py +0 -0
  143. {lager_cli-0.59.0 → lager_cli-0.61.0}/setup.cfg +0 -0
  144. {lager_cli-0.59.0 → lager_cli-0.61.0}/setup.py +0 -0
  145. {lager_cli-0.59.0 → lager_cli-0.61.0}/simple_hdlc.py +0 -0
  146. {lager_cli-0.59.0 → lager_cli-0.61.0}/sort_utils.py +0 -0
  147. {lager_cli-0.59.0 → lager_cli-0.61.0}/status.py +0 -0
  148. {lager_cli-0.59.0 → lager_cli-0.61.0}/supply/__init__.py +0 -0
  149. {lager_cli-0.59.0 → lager_cli-0.61.0}/supply/supply_tui.py +0 -0
  150. {lager_cli-0.59.0 → lager_cli-0.61.0}/supply/websocket_client.py +0 -0
  151. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/__init__.py +0 -0
  152. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/core/__init__.py +0 -0
  153. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/core/executor.py +0 -0
  154. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/main.py +0 -0
  155. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/ui/__init__.py +0 -0
  156. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/ui/completer.py +0 -0
  157. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/ui/display.py +0 -0
  158. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/ui/logo.py +0 -0
  159. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/ui/repl.py +0 -0
  160. {lager_cli-0.59.0 → lager_cli-0.61.0}/terminal/ui/themes.py +0 -0
  161. {lager_cli-0.59.0 → lager_cli-0.61.0}/update_check.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lager-cli
3
- Version: 0.59.0
3
+ Version: 0.61.0
4
4
  Summary: Lager CLI - Box and Docker connectivity
5
5
  Home-page: https://github.com/lagerdata/lager
6
6
  Author: Lager Data
@@ -7,4 +7,4 @@ Lager CLI
7
7
  A Command Line Interface for Lager Data
8
8
  """
9
9
 
10
- __version__ = '0.59.0'
10
+ __version__ = '0.61.0'
@@ -1202,6 +1202,39 @@ import contextlib as _contextlib_for_lock
1202
1202
  import threading as _threading_for_heartbeat
1203
1203
 
1204
1204
 
1205
+ def _exit_cleanly_on_terminate():
1206
+ """Make SIGTERM and SIGHUP run this process's lock release.
1207
+
1208
+ Python's default action for both kills the process without running
1209
+ ``finally`` blocks or ``atexit`` handlers, so a lock taken by a command
1210
+ that is stopped with a plain ``kill`` stayed held until its TTL ran out.
1211
+ A test that backgrounds `lager debug ... gdbserver` and later kills it
1212
+ left its CI job's lock held that way. Raising ``SystemExit`` instead
1213
+ unwinds normally, so the release runs. The exit status is the shell's
1214
+ ``128 + signal``, the same one the default action reports.
1215
+
1216
+ A handler someone else installed is left alone, and so is a call off the
1217
+ main thread, where Python cannot install one.
1218
+ """
1219
+ import signal
1220
+
1221
+ if _threading_for_heartbeat.current_thread() is not _threading_for_heartbeat.main_thread():
1222
+ return
1223
+
1224
+ def _raise_exit(signum, _frame):
1225
+ raise SystemExit(128 + signum)
1226
+
1227
+ for name in ('SIGTERM', 'SIGHUP'):
1228
+ signum = getattr(signal, name, None)
1229
+ if signum is None:
1230
+ continue
1231
+ try:
1232
+ if signal.getsignal(signum) is signal.SIG_DFL:
1233
+ signal.signal(signum, _raise_exit)
1234
+ except (OSError, ValueError):
1235
+ pass
1236
+
1237
+
1205
1238
  class HeartbeatThread(_threading_for_heartbeat.Thread):
1206
1239
  """Refreshes the box lock periodically while a command is running.
1207
1240
 
@@ -1653,6 +1686,7 @@ def auto_lock_around_command(
1653
1686
  # actually hold the lock — no surprise release of someone
1654
1687
  # else's lock at interpreter shutdown.
1655
1688
  _atexit.register(_safe_release)
1689
+ _exit_cleanly_on_terminate()
1656
1690
 
1657
1691
  heartbeat = None
1658
1692
  # Heartbeat whenever the lock we're running under has a TTL: locks
@@ -1864,6 +1898,7 @@ def auto_lock_acquire_for_command(
1864
1898
 
1865
1899
  if should_release:
1866
1900
  _atexit.register(_release)
1901
+ _exit_cleanly_on_terminate()
1867
1902
  if resolved_ttl is not None:
1868
1903
  heartbeat = HeartbeatThread(
1869
1904
  ip,
@@ -456,10 +456,14 @@ def _fmt_usbhub_lines(d: dict):
456
456
 
457
457
  def _classify_usb_hub(d: dict):
458
458
  """(colour, headline) for a USB hub net. Most specific first."""
459
- if d.get('unavailable') or d.get('transport_error'):
459
+ if d.get('unavailable'):
460
460
  return ('yellow',
461
461
  'UNCLEAR — this box does not serve /diagnose/usbhub. '
462
462
  'Update the box to diagnose hub nets.')
463
+ # A timeout or 5xx says nothing about the box's version: only a 404
464
+ # (`unavailable`) means the endpoint is missing.
465
+ if d.get('transport_error'):
466
+ return ('red', f'Could not reach the USB hub diagnose endpoint: {d["transport_error"]}')
463
467
 
464
468
  if d.get('enumerated') is False:
465
469
  return ('red',
@@ -31,6 +31,18 @@ from ...core.utils import SizeLimitExceeded, zip_dir
31
31
  MANIFEST_FILE = 'lager_driver.json'
32
32
  DRIVER_FILE = 'driver.py'
33
33
  MAX_BUNDLE_BYTES = 5 * 1024 * 1024
34
+ # The box gives pip up to 300 s (lager.drivers.deps.DEPS_TIMEOUT_S) inside
35
+ # the install request; wait a minute longer than that.
36
+ DEPS_HTTP_TIMEOUT = 360
37
+
38
+
39
+ def _deps_cell(deps):
40
+ if not deps:
41
+ return '-'
42
+ if deps.get('status') != 'ok':
43
+ return deps.get('status') or '?'
44
+ count = len(deps.get('packages') or [])
45
+ return f"{count} package{'' if count == 1 else 's'}"
34
46
 
35
47
 
36
48
  def _resolve(ctx, box, read_only=False):
@@ -77,14 +89,15 @@ def list_cmd(ctx, box, as_json):
77
89
  return
78
90
  table = Texttable()
79
91
  table.set_deco(Texttable.HEADER)
80
- table.set_cols_dtype(['t'] * 5)
81
- table.header(['Type', 'Version', 'Status', 'SHA-256', 'Nets'])
92
+ table.set_cols_dtype(['t'] * 6)
93
+ table.header(['Type', 'Version', 'Status', 'Deps', 'SHA-256', 'Nets'])
82
94
  for e in entries:
83
95
  status = e.get('status', '')
84
96
  if status == 'error':
85
97
  status = f"error: {e.get('error', '')}"
86
98
  table.add_row([e.get('type', ''), e.get('version') or '-', status,
87
- (e.get('sha256') or '')[:12], ', '.join(e.get('nets') or []) or '-'])
99
+ _deps_cell(e.get('deps')), (e.get('sha256') or '')[:12],
100
+ ', '.join(e.get('nets') or []) or '-'])
88
101
  click.echo(table.draw())
89
102
 
90
103
 
@@ -114,6 +127,9 @@ def show(ctx, driver_type, box):
114
127
  req = ', required' if spec.get('required') and 'default' not in spec else ''
115
128
  dflt = f", default {spec['default']}" if 'default' in spec else ''
116
129
  click.echo(f" {name:<16} <{kind}{req}{dflt}> {spec.get('help', '')}".rstrip())
130
+ packages = (entry.get('deps') or {}).get('packages') or []
131
+ if packages:
132
+ click.echo(f"\nPython packages: {', '.join(packages)}")
117
133
  click.echo("\nActions:")
118
134
  for line in describe_actions(manifest):
119
135
  click.echo(line)
@@ -133,9 +149,23 @@ def _read_local_manifest(path):
133
149
  raise click.UsageError(f"{MANIFEST_FILE} in {path} has no \"type\"")
134
150
  if not os.path.isfile(os.path.join(path, DRIVER_FILE)):
135
151
  raise click.UsageError(f"{path} has no {DRIVER_FILE}")
152
+ requirements = manifest.get('requirements')
153
+ if requirements and not os.path.isfile(os.path.join(path, str(requirements))):
154
+ raise click.UsageError(f"{path} has no {requirements}, which {MANIFEST_FILE} "
155
+ f"names as its requirements")
136
156
  return manifest
137
157
 
138
158
 
159
+ def _require_deps_support(ctx, box_ip):
160
+ status = driver_request(ctx, box_ip, 'GET', '/status')
161
+ caps = status.get('capabilities') if isinstance(status, dict) else None
162
+ if not (isinstance(caps, dict) and caps.get('customDriverDeps')):
163
+ click.secho("Error: this driver declares Python packages, and this box's Lager is "
164
+ "too old to install them. Update it with `lager update --box <BOX>`.",
165
+ fg='red', err=True)
166
+ ctx.exit(1)
167
+
168
+
139
169
  @drivers.command('install')
140
170
  @click.argument('bundle_dir', type=click.Path(exists=True, file_okay=False))
141
171
  @click.option('--box', required=False, help='Lager Box name or IP')
@@ -147,10 +177,17 @@ def install(ctx, bundle_dir, box, yes):
147
177
 
148
178
  The directory must hold lager_driver.json and driver.py. The box checks
149
179
  the manifest; nothing is installed if it is invalid.
180
+
181
+ If the manifest names a requirements file, the box installs those
182
+ Python packages with the driver. Package code runs on the box with
183
+ full access to its hardware: install only packages you trust.
150
184
  """
151
185
  manifest = _read_local_manifest(bundle_dir)
152
186
  dtype = manifest['type']
153
187
  box_ip = _resolve(ctx, box)
188
+ has_requirements = bool(manifest.get('requirements'))
189
+ if has_requirements:
190
+ _require_deps_support(ctx, box_ip)
154
191
 
155
192
  installed = {e.get('type'): e for e in _list_entries(ctx, box_ip)}
156
193
  current = installed.get(dtype)
@@ -168,18 +205,50 @@ def install(ctx, bundle_dir, box, yes):
168
205
  f"{MAX_BUNDLE_BYTES // (1024 * 1024)} MB; a driver bundle must be smaller.",
169
206
  fg='red', err=True)
170
207
  ctx.exit(1)
171
- result = driver_request(ctx, box_ip, 'PUT', f'/drivers/{dtype}', timeout=120,
208
+ if has_requirements:
209
+ click.echo(f"Installing the Python packages in {manifest['requirements']} on the box; "
210
+ f"this can take a few minutes...")
211
+ result = driver_request(ctx, box_ip, 'PUT', f'/drivers/{dtype}',
212
+ timeout=DEPS_HTTP_TIMEOUT if has_requirements else 120,
172
213
  files={'bundle': (f'{dtype}.zip', data, 'application/zip')})
173
214
  forget_box_drivers(box_ip)
174
215
  verb = 'Replaced' if result.get('replaced') else 'Installed'
175
216
  click.secho(f"{verb} driver '{dtype}' {result.get('version', '')} "
176
217
  f"(sha256 {(result.get('sha256') or '')[:12]}).", fg='green')
218
+ if result.get('packages'):
219
+ click.echo(f"Python packages: {', '.join(result['packages'])}")
177
220
  if not result.get('replaced'):
178
221
  click.echo("Next, add a net that uses it:")
179
222
  click.echo(f" lager nets add-custom <NET_NAME> {dtype} --param NAME=VALUE --box <BOX>")
180
223
  click.echo(f"See its settings with: lager drivers show {dtype} --box <BOX>")
181
224
 
182
225
 
226
+ @drivers.command('reinstall-deps')
227
+ @click.argument('driver_type')
228
+ @click.option('--box', required=False, help='Lager Box name or IP')
229
+ @click.pass_context
230
+ def reinstall_deps(ctx, driver_type, box):
231
+ """
232
+ Reinstall a driver's Python packages on a box
233
+
234
+ Use this when `lager drivers list` shows its packages as stale, after
235
+ an update changed the box's Python version. The packages come from the
236
+ requirements file already in the installed bundle.
237
+ """
238
+ box_ip = _resolve(ctx, box)
239
+ _require_deps_support(ctx, box_ip)
240
+ click.echo(f"Reinstalling the Python packages of '{driver_type}'; "
241
+ f"this can take a few minutes...")
242
+ result = driver_request(ctx, box_ip, 'POST', f'/drivers/{driver_type}/deps',
243
+ timeout=DEPS_HTTP_TIMEOUT)
244
+ forget_box_drivers(box_ip)
245
+ packages = result.get('packages') or []
246
+ click.secho(f"Reinstalled {len(packages)} package{'' if len(packages) == 1 else 's'} "
247
+ f"for '{driver_type}'.", fg='green')
248
+ if packages:
249
+ click.echo(', '.join(packages))
250
+
251
+
183
252
  @drivers.command('remove')
184
253
  @click.argument('driver_type')
185
254
  @click.option('--box', required=False, help='Lager Box name or IP')
@@ -573,6 +573,7 @@ INSTRUMENT_NET_MAP: dict[str, list[str]] = {
573
573
  "Acroname_8Port": ["usb"],
574
574
  "Acroname_4Port": ["usb"],
575
575
  "YKUSH_Hub": ["usb"],
576
+ "YKUSH3_Hub": ["usb", "gpio"],
576
577
  "Plugable_USB_Hub": ["usb"],
577
578
 
578
579
  # eload
@@ -591,6 +592,7 @@ INSTRUMENT_NET_MAP: dict[str, list[str]] = {
591
592
  "Logitech_C270": ["webcam"],
592
593
  "Logitech_StreamCam": ["webcam"],
593
594
  "ELP_Global_Shutter_AR0234": ["webcam"],
595
+ "IPEVO_V4K_PRO": ["webcam"],
594
596
 
595
597
  # (robot) arm
596
598
  "Rotrix_Dexarm": ["arm"],
@@ -0,0 +1,405 @@
1
+ # Copyright 2024-2026 Lager Data
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """
5
+ lager.wifi.commands
6
+
7
+ Commands for controlling WiFi
8
+ """
9
+ from __future__ import annotations
10
+
11
+ import json
12
+ import re
13
+ import shlex
14
+
15
+ import click
16
+
17
+ # Import consolidated helpers from cli.core.net_helpers
18
+ from ...core.group_usage import LagerGroup
19
+ from ...core.net_helpers import resolve_box, resolve_box_locked, post_box_command
20
+ from ...errors import LagerError, ssh_error
21
+ from ..box._ssh import default_ssh_runner, resolve_box_user, strip_ssh_banner
22
+
23
+ # WiFi constraints
24
+ MAX_SSID_LENGTH = 32 # IEEE 802.11 maximum SSID length
25
+ MIN_WPA_PASSWORD_LENGTH = 8 # WPA/WPA2 minimum passphrase length
26
+ MAX_WPA_PASSWORD_LENGTH = 63 # WPA/WPA2 maximum passphrase length
27
+
28
+ # Common wireless interface names
29
+ COMMON_INTERFACES = ['wlan0', 'wlan1', 'wlp2s0', 'wlp3s0', 'wifi0']
30
+
31
+
32
+ def _validate_ssid(ctx: click.Context, ssid: str) -> None:
33
+ """Validate SSID format and length."""
34
+ if not ssid:
35
+ click.secho("Error: SSID cannot be empty", fg='red', err=True)
36
+ ctx.exit(1)
37
+
38
+ if len(ssid) > MAX_SSID_LENGTH:
39
+ click.secho(f"Error: SSID too long ({len(ssid)} characters)", fg='red', err=True)
40
+ click.secho(f"Maximum SSID length is {MAX_SSID_LENGTH} characters.", err=True)
41
+ ctx.exit(1)
42
+
43
+ # Check for non-printable characters
44
+ if not ssid.isprintable():
45
+ click.secho("Error: SSID contains non-printable characters", fg='red', err=True)
46
+ ctx.exit(1)
47
+
48
+
49
+ def _validate_password(ctx: click.Context, password: str) -> None:
50
+ """Validate WPA/WPA2 password length (if provided)."""
51
+ if not password:
52
+ return # Empty password is allowed for open networks
53
+
54
+ if len(password) < MIN_WPA_PASSWORD_LENGTH:
55
+ click.secho(f"Error: Password too short ({len(password)} characters)", fg='red', err=True)
56
+ click.secho(f"WPA/WPA2 passwords must be at least {MIN_WPA_PASSWORD_LENGTH} characters.", err=True)
57
+ ctx.exit(1)
58
+
59
+ if len(password) > MAX_WPA_PASSWORD_LENGTH:
60
+ click.secho(f"Error: Password too long ({len(password)} characters)", fg='red', err=True)
61
+ click.secho(f"WPA/WPA2 passwords can be at most {MAX_WPA_PASSWORD_LENGTH} characters.", err=True)
62
+ ctx.exit(1)
63
+
64
+
65
+ def _validate_interface(ctx: click.Context, interface: str) -> None:
66
+ """Validate wireless interface name format."""
67
+ if not interface:
68
+ click.secho("Error: Interface name cannot be empty", fg='red', err=True)
69
+ ctx.exit(1)
70
+
71
+ # Interface names should be alphanumeric and not too long
72
+ if len(interface) > 15: # Linux IFNAMSIZ - 1
73
+ click.secho(f"Error: Interface name too long: {interface}", fg='red', err=True)
74
+ click.secho("Interface names must be 15 characters or less.", err=True)
75
+ ctx.exit(1)
76
+
77
+ # Warn if using non-standard interface name
78
+ if interface not in COMMON_INTERFACES and not interface.startswith('wl'):
79
+ click.secho(f"Note: '{interface}' is not a common wireless interface name.", fg='yellow', err=True)
80
+ click.secho(f"Common names: {', '.join(COMMON_INTERFACES)}", err=True)
81
+
82
+
83
+ # nmcli connect can take up to ~30s on the box, plus scan latency.
84
+ _WIFI_HTTP_TIMEOUT = 60.0
85
+
86
+
87
+ def _post_wifi(ctx: click.Context, box_ip: str, action: str, **params) -> dict:
88
+ """POST one action to :9000/wifi/command and return the response."""
89
+ return post_box_command(
90
+ ctx, box_ip, "/wifi/command", action,
91
+ quiet=True, http_timeout=_WIFI_HTTP_TIMEOUT, **params,
92
+ )
93
+
94
+
95
+ def _format_networks_table(networks: list[dict]) -> str:
96
+ """Format scan results in the same table shape the old impl printed."""
97
+ if not networks:
98
+ return "No networks found!"
99
+
100
+ lines = []
101
+ lines.append(f"{'SSID':<25} {'Security':<10} {'Strength'}")
102
+ lines.append("-" * 50)
103
+ for net in networks:
104
+ ssid = (net.get('ssid') or 'Unknown')[:24]
105
+ security = net.get('security', 'Unknown')
106
+ strength = net.get('strength', 0)
107
+ lines.append(f"{ssid:<25} {security:<10} {strength}%")
108
+ return '\n'.join(lines)
109
+
110
+
111
+ # `status` and `access-points` read the box host's Wi-Fi over SSH. The lager
112
+ # container cannot: on its default network it has no view of the host's
113
+ # wireless interface, and the image has no nmcli, so both lookups failed there
114
+ # and `status` still exited 0. They only read, so they take no box lock.
115
+ #
116
+ # Every source is read as the box's SSH user, without root, and each is
117
+ # optional. sysfs names the wireless interfaces on any Linux host;
118
+ # networkctl (systemd-networkd, the box install's default), nmcli
119
+ # (NetworkManager) and iw add the state and the SSID where present.
120
+ _HOST_SSH_TIMEOUT = 45
121
+
122
+ _MISSING = '!missing'
123
+
124
+ _WIRELESS_IFACES = (
125
+ 'for d in /sys/class/net/*/wireless; do [ -e "$d" ] || continue; '
126
+ 'basename "$(dirname "$d")"; done'
127
+ )
128
+
129
+ _STATUS_SCRIPT = (
130
+ "echo '--wireless--'; "
131
+ f"for i in $({_WIRELESS_IFACES}); do echo \"$i $(cat /sys/class/net/$i/operstate)\"; done; "
132
+ "echo '--networkctl--'; "
133
+ "if command -v networkctl >/dev/null 2>&1; then "
134
+ f"for i in $({_WIRELESS_IFACES}); do echo \"@$i\"; "
135
+ "networkctl status \"$i\" --no-pager 2>/dev/null | grep -E '^ *(State|Wi-?Fi access point):'; done; "
136
+ f"else echo '{_MISSING}'; fi; "
137
+ "echo '--nmcli--'; "
138
+ f"nmcli -t -f DEVICE,TYPE,STATE,CONNECTION device status 2>/dev/null || echo '{_MISSING}'; "
139
+ "echo '--iw--'; "
140
+ f"iw dev 2>/dev/null || echo '{_MISSING}'"
141
+ )
142
+
143
+ _SECTIONS = ('wireless', 'networkctl', 'nmcli', 'iw')
144
+
145
+ _NMCLI_STATES = {
146
+ 'connected': 'Connected',
147
+ 'disconnected': 'Disconnected',
148
+ 'unavailable': 'Unavailable (radio off or no driver)',
149
+ 'unmanaged': 'Not managed by NetworkManager',
150
+ }
151
+
152
+
153
+ def _nmcli_fields(line: str) -> list[str]:
154
+ """Split one `nmcli -t` line on its unescaped colons."""
155
+ return [f.replace('\\:', ':').replace('\\\\', '\\')
156
+ for f in re.split(r'(?<!\\):', line)]
157
+
158
+
159
+ def _parse_host_status(out: str) -> tuple[dict, bool]:
160
+ """Turn the status script's output into interfaces, and whether it ran.
161
+
162
+ sysfs lists the interfaces and whether each is up. The SSID comes from
163
+ `iw dev` or networkctl; nmcli knows only a connection name, which need
164
+ not match it, so that is the last resort.
165
+ """
166
+ sections, current = {}, None
167
+ for line in out.splitlines():
168
+ marker = line.strip('-')
169
+ if line.startswith('--') and marker in _SECTIONS:
170
+ current = marker
171
+ sections[current] = []
172
+ elif current is not None:
173
+ sections[current].append(line)
174
+
175
+ interfaces = {}
176
+
177
+ def _iface(name):
178
+ return interfaces.setdefault(name, {
179
+ 'interface': name, 'ssid': 'Not Connected', 'state': 'Disconnected'})
180
+
181
+ for line in sections.get('wireless', []):
182
+ words = line.split()
183
+ if not words:
184
+ continue
185
+ info = _iface(words[0])
186
+ if len(words) > 1 and words[1] == 'up':
187
+ info['state'] = 'Up'
188
+ info['ssid'] = 'Unknown'
189
+
190
+ networkctl = sections.get('networkctl', [_MISSING])
191
+ if _MISSING not in networkctl:
192
+ name = None
193
+ for line in networkctl:
194
+ if line.startswith('@'):
195
+ name = line[1:].strip()
196
+ continue
197
+ key, _, value = line.strip().partition(':')
198
+ if not name or not value:
199
+ continue
200
+ value = value.strip()
201
+ if key in ('WiFi access point', 'Wi-Fi access point'):
202
+ info = _iface(name)
203
+ info['ssid'] = re.sub(r'\s*\([0-9a-fA-F:]{17}\)$', '', value)
204
+ info['state'] = 'Connected'
205
+ elif key == 'State' and value.split(' ')[0] in ('no-carrier', 'off', 'dormant'):
206
+ info = _iface(name)
207
+ if info['state'] != 'Connected':
208
+ info['state'], info['ssid'] = 'Disconnected', 'Not Connected'
209
+
210
+ iw = sections.get('iw', [_MISSING])
211
+ if _MISSING not in iw:
212
+ name = None
213
+ for line in iw:
214
+ words = line.split()
215
+ if len(words) >= 2 and words[0] == 'Interface':
216
+ name = words[1]
217
+ _iface(name)
218
+ elif name and len(words) >= 2 and words[0] == 'ssid':
219
+ interfaces[name]['ssid'] = line.strip()[len('ssid '):]
220
+ interfaces[name]['state'] = 'Connected'
221
+
222
+ nmcli = sections.get('nmcli', [_MISSING])
223
+ if _MISSING not in nmcli:
224
+ for line in nmcli:
225
+ fields = _nmcli_fields(line)
226
+ if len(fields) < 4 or fields[1] != 'wifi':
227
+ continue
228
+ device, _type, state, connection = fields[:4]
229
+ info = _iface(device)
230
+ base = state.split(' ')[0]
231
+ info['state'] = _NMCLI_STATES.get(base, state)
232
+ if base == 'connected' and info['ssid'] in ('Not Connected', 'Unknown') and connection:
233
+ info['ssid'] = connection
234
+ return interfaces, 'wireless' in sections
235
+
236
+
237
+ def _run_on_host(box_ip: str, cmd: str) -> tuple[int, str, str]:
238
+ """Run a read-only command on the box host; SSH's own failures exit here."""
239
+ rc, out, err = default_ssh_runner(box_ip, cmd, timeout=_HOST_SSH_TIMEOUT)
240
+ if rc == 255:
241
+ raise ssh_error(strip_ssh_banner(err), box_ip, resolve_box_user(box_ip))
242
+ return rc, out, err
243
+
244
+
245
+ @click.group(name='wifi', cls=LagerGroup, hidden=True)
246
+ def _wifi():
247
+ """Manage WiFi network settings"""
248
+ pass
249
+
250
+
251
+ @_wifi.command()
252
+ @click.pass_context
253
+ @click.option("--box", required=False, help="Lager Box name or IP")
254
+ def status(ctx, box):
255
+ """
256
+ Get the current WiFi Status of the box
257
+ """
258
+ box_ip = resolve_box(ctx, box, read_only=True)
259
+
260
+ _rc, out, _err = _run_on_host(box_ip, _STATUS_SCRIPT)
261
+ found, readable = _parse_host_status(out)
262
+ if not readable:
263
+ raise LagerError(
264
+ "Cannot read the box's Wi-Fi state.",
265
+ cause="The command on the box host did not run.",
266
+ )
267
+ if not found:
268
+ raise LagerError("The box has no wireless interface.")
269
+
270
+ click.secho("WiFi Status:", fg='green')
271
+ click.echo("=" * 40)
272
+ for info in found.values():
273
+ connected = info.get('state', '').startswith('Connected')
274
+ click.secho(f"Interface: {info.get('interface')}", fg='green')
275
+ click.secho(f" SSID: {info.get('ssid')}",
276
+ fg='green' if connected else 'red')
277
+ click.secho(f" State: {info.get('state')}",
278
+ fg='green' if connected else 'red')
279
+ click.echo()
280
+
281
+
282
+ def _scan_on_host(box_ip: str, interface: str | None,
283
+ box_label: str) -> tuple[str, list[dict]]:
284
+ """List the access points the box host sees, strongest first.
285
+
286
+ Returns the interface scanned (the first wireless one when none is named)
287
+ and the networks. nmcli lists one row per access point, so a network with
288
+ several shows up several times; each SSID is kept once, at its strongest.
289
+ """
290
+ given = shlex.quote(interface) if interface else "''"
291
+ cmd = (f"IF={given}; "
292
+ f"[ -n \"$IF\" ] || IF=$({_WIRELESS_IFACES} | head -n 1); "
293
+ "echo \"@$IF\"; "
294
+ "[ -n \"$IF\" ] || exit 0; "
295
+ f"command -v nmcli >/dev/null 2>&1 || {{ echo '{_MISSING}'; exit 0; }}; "
296
+ "nmcli -t -f SSID,SECURITY,SIGNAL device wifi list ifname \"$IF\"")
297
+ rc, out, err = _run_on_host(box_ip, cmd)
298
+ lines = out.splitlines()
299
+ scanned = lines[0][1:].strip() if lines and lines[0].startswith('@') else (interface or '')
300
+ rows = lines[1:] if lines and lines[0].startswith('@') else lines
301
+ if not scanned:
302
+ raise LagerError("The box has no wireless interface.")
303
+ if [r.strip() for r in rows] == [_MISSING]:
304
+ raise LagerError(
305
+ f"Cannot list the access points on {scanned}.",
306
+ cause=("The box host does not run NetworkManager, and a scan without it "
307
+ "needs root on the box host."),
308
+ fixes=[f"See the network the box is on: lager wifi status --box {box_label}"],
309
+ )
310
+ if rc != 0:
311
+ raise LagerError(
312
+ f"The Wi-Fi scan on {scanned} failed.",
313
+ cause=strip_ssh_banner(err) or f"nmcli exited {rc} on the box host.",
314
+ )
315
+
316
+ best = {}
317
+ for line in rows:
318
+ fields = _nmcli_fields(line)
319
+ if len(fields) < 3 or not fields[0]:
320
+ continue
321
+ ssid, security, signal = fields[0], fields[1], fields[2]
322
+ try:
323
+ strength = int(signal)
324
+ except ValueError:
325
+ strength = 0
326
+ if ssid not in best or strength > best[ssid]['strength']:
327
+ best[ssid] = {'ssid': ssid, 'security': security or 'Open',
328
+ 'strength': strength}
329
+ return scanned, sorted(best.values(), key=lambda n: n['strength'], reverse=True)
330
+
331
+
332
+ @_wifi.command()
333
+ @click.pass_context
334
+ @click.option("--box", required=False, help="Lager Box name or IP")
335
+ @click.option('--interface', required=False, default=None,
336
+ help="Wireless interface to use (default: the box's first wireless interface)")
337
+ def access_points(ctx, box, interface=None):
338
+ """
339
+ Get WiFi access points visible to the box
340
+ """
341
+ if interface is not None:
342
+ _validate_interface(ctx, interface)
343
+
344
+ box_ip = resolve_box(ctx, box, read_only=True)
345
+
346
+ scanned, networks = _scan_on_host(box_ip, interface, box or box_ip)
347
+ click.secho(f"Scanned for WiFi networks on {scanned}.", fg='green')
348
+
349
+ click.secho(f"\nFound {len(networks)} network(s):", fg='green')
350
+ click.secho(_format_networks_table(networks), fg='green')
351
+
352
+ click.secho("\nJSON Output:", fg='green')
353
+ click.echo(json.dumps({'access_points': networks}, indent=2))
354
+
355
+
356
+ @_wifi.command()
357
+ @click.pass_context
358
+ @click.option("--box", required=False, help="Lager Box name or IP")
359
+ @click.option('--ssid', required=True, help='SSID of the network to connect to')
360
+ @click.option('--interface', help='Wireless interface to use', default='wlan0', show_default=True)
361
+ @click.option('--password', required=False, help='Password of the network to connect to', default='')
362
+ def connect(ctx, box, ssid, interface, password=''):
363
+ """
364
+ Connect the box to a new network
365
+ """
366
+ # Validate inputs
367
+ _validate_ssid(ctx, ssid)
368
+ _validate_password(ctx, password)
369
+ _validate_interface(ctx, interface)
370
+
371
+ box_ip = resolve_box_locked(ctx, box, 'wifi')
372
+
373
+ click.secho(f"Connecting to WiFi network: {ssid}", fg='green')
374
+ result = _post_wifi(ctx, box_ip, 'connect',
375
+ ssid=ssid, password=password, interface=interface)
376
+
377
+ click.secho(f"[OK] Successfully connected to {ssid}", fg='green')
378
+ click.echo("\nJSON Output:")
379
+ click.echo(json.dumps(result.get('value') or {}, indent=2))
380
+
381
+
382
+ @_wifi.command()
383
+ @click.pass_context
384
+ @click.option("--box", required=False, help="Lager Box name or IP")
385
+ @click.option('--yes', is_flag=True, help='Confirm the action without prompting')
386
+ @click.argument('SSID', required=True)
387
+ def delete_connection(ctx, box, yes, ssid):
388
+ """
389
+ Delete the specified network from the box
390
+ """
391
+ # Validate SSID format
392
+ _validate_ssid(ctx, ssid)
393
+
394
+ if not yes and not click.confirm('An ethernet connection will be required to bring the box back online. Proceed?', default=False):
395
+ click.echo("Aborting")
396
+ return
397
+
398
+ box_ip = resolve_box_locked(ctx, box, 'wifi')
399
+
400
+ click.secho(f"Deleting WiFi connection: {ssid}", fg='green')
401
+ result = _post_wifi(ctx, box_ip, 'delete', ssid=ssid, connection_name=ssid)
402
+
403
+ click.secho(f"[OK] Successfully deleted connection: {ssid}", fg='green')
404
+ click.echo("\nJSON Output:")
405
+ click.echo(json.dumps(result.get('value') or {}, indent=2))