lager-cli 0.32.3__tar.gz → 0.32.4__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.
- {lager_cli-0.32.3/lager_cli.egg-info → lager_cli-0.32.4}/PKG-INFO +1 -1
- {lager_cli-0.32.3 → lager_cli-0.32.4}/__init__.py +1 -1
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/uninstall.py +8 -3
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/scripts/setup_and_deploy_box.sh +19 -15
- {lager_cli-0.32.3 → lager_cli-0.32.4}/gateway_auth.py +60 -12
- {lager_cli-0.32.3 → lager_cli-0.32.4/lager_cli.egg-info}/PKG-INFO +1 -1
- {lager_cli-0.32.3 → lager_cli-0.32.4}/LICENSE +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/MANIFEST.in +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/README.md +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/__main__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/address_utils.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/battery/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/battery/battery_tui.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/battery/websocket_client.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/box_storage.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/_host_ops.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/_mount_prep.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/_pip_validation.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/_shim_verbs.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/_ssh.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/box_group.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/boxes.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/config.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/diagnose.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/dut.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/hello.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/instruments.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/labjack_pins.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/lock.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/net_tui.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/nets.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/ssh.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/box/ssh_setup.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/ble.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/blufi.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/i2c.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/router.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/spi.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/uart.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/usb.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/websocket_client.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/communication/wifi.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/arm.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/debug/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/debug/commands.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/debug/gdb.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/debug/net_cache.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/debug/service_client.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/debug/service_helper.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/debug/tunnel.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/devenv.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/development/python.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/adc.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/dac.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/energy.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/gpi.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/gpo.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/logic.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/scope.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/thermocouple.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/measurement/watt.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/power/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/power/battery.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/power/battery_model_csv.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/power/eload.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/power/solar.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/power/supply.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/binaries.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/defaults.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/exec_.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/install.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/install_wheel.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/login.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/logs.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/update.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/commands/utility/webcam.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/config.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/context/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/context/ci_detection.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/context/constants.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/context/core.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/context/error_handlers.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/context/session.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/group_usage.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/matchers.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/net_group.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/net_helpers.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/net_storage.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/param_types.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/ssh_utils.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/utils.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/version_skew.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/core/ws_diagnose.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/scripts/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/scripts/configure_docker_dns.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/scripts/configure_docker_dns.sh +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/scripts/convert_to_sparse_checkout.sh +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/scripts/setup_ssh_key.sh +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/security/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/deployment/security/secure_box_firewall.sh +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/common/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/common/construct_utils.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/common/exceptions.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/common/py3compat.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/common/utils.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/construct/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/construct/adapters.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/construct/core.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/construct/debug.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/construct/macros.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/abbrevtable.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/aranges.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/callframe.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/compileunit.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/constants.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/descriptions.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/die.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/dwarf_expr.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/dwarfinfo.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/enums.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/lineprogram.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/locationlists.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/namelut.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/ranges.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/dwarf/structs.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/ehabi/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/ehabi/constants.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/ehabi/decoder.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/ehabi/ehabiinfo.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/ehabi/structs.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/constants.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/descriptions.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/dynamic.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/elffile.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/enums.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/gnuversions.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/hash.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/notes.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/relocation.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/sections.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/segments.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/elftools/elf/structs.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/errors.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/exceptions.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/impl/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/impl/box_config.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/impl/measurement/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/impl/measurement/scope.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/impl/measurement/scope_stream.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/impl/power/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/impl/power/enable_disable.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/lager_cli.egg-info/SOURCES.txt +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/lager_cli.egg-info/dependency_links.txt +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/lager_cli.egg-info/entry_points.txt +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/lager_cli.egg-info/requires.txt +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/lager_cli.egg-info/top_level.txt +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/main.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/pyproject.toml +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/safe_unpickle.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/setup.cfg +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/setup.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/simple_hdlc.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/sort_utils.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/status.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/supply/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/supply/supply_tui.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/supply/websocket_client.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/core/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/core/executor.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/main.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/ui/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/ui/completer.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/ui/display.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/ui/logo.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/ui/repl.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/terminal/ui/themes.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/tests/test_box_lager_imports.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/tests/test_box_storage.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/tests/test_gateway_auth.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/tests/test_io_imports.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/tests/test_update_gate.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/update_check.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/vendor/PyCRC/CRC16.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/vendor/PyCRC/CRC16DNP.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/vendor/PyCRC/CRC16Kermit.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/vendor/PyCRC/CRC16SICK.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/vendor/PyCRC/CRC32.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/vendor/PyCRC/CRCCCITT.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/vendor/PyCRC/__init__.py +0 -0
- {lager_cli-0.32.3 → lager_cli-0.32.4}/vendor/__init__.py +0 -0
|
@@ -603,7 +603,7 @@ def uninstall(ctx, box, ip, user, keep_config, keep_docker_images, remove_all, y
|
|
|
603
603
|
click.echo(" - Docker containers (lager, pigpio)")
|
|
604
604
|
click.echo(" - Docker network (lagernet)")
|
|
605
605
|
if not keep_docker_images:
|
|
606
|
-
click.echo(" - Docker images (
|
|
606
|
+
click.echo(" - Docker images (the lager image and dangling layers only)")
|
|
607
607
|
click.echo(" - ~/box directory")
|
|
608
608
|
if not keep_config:
|
|
609
609
|
click.echo(" - /etc/lager directory (saved nets)")
|
|
@@ -707,10 +707,15 @@ def uninstall(ctx, box, ip, user, keep_config, keep_docker_images, remove_all, y
|
|
|
707
707
|
run_ssh("docker network rm lagernet 2>/dev/null", "Removing lagernet network", allow_fail=True)
|
|
708
708
|
click.echo()
|
|
709
709
|
|
|
710
|
-
# Remove Docker images (unless --keep-docker-images)
|
|
710
|
+
# Remove Docker images (unless --keep-docker-images). Scoped to the
|
|
711
|
+
# lager image plus dangling layers: 'prune -af' would also delete
|
|
712
|
+
# images belonging to any OTHER stopped container on the box (a
|
|
713
|
+
# management agent, a user's own services) — infrastructure this
|
|
714
|
+
# command cannot restore.
|
|
711
715
|
click.secho("[Step 2/5] Cleaning Docker...", fg='cyan')
|
|
712
716
|
if not keep_docker_images:
|
|
713
|
-
run_ssh("docker
|
|
717
|
+
run_ssh("docker rmi -f lager 2>/dev/null", "Removing lager image", allow_fail=True)
|
|
718
|
+
run_ssh("docker image prune -f 2>/dev/null", "Removing dangling images", allow_fail=True)
|
|
714
719
|
run_ssh("docker builder prune -af 2>/dev/null", "Clearing Docker build cache", allow_fail=True)
|
|
715
720
|
else:
|
|
716
721
|
click.echo(" Skipping Docker image removal (--keep-docker-images)")
|
|
@@ -1339,33 +1339,37 @@ print_info "Ensuring Docker service is enabled (for auto-start on boot)..."
|
|
|
1339
1339
|
ssh $SSH_OPTS "${BOX_USER}@${BOX_IP}" "sudo systemctl enable docker >/dev/null 2>&1 || true"
|
|
1340
1340
|
print_success "Docker service enabled"
|
|
1341
1341
|
|
|
1342
|
-
print_info "Stopping and removing
|
|
1343
|
-
#
|
|
1342
|
+
print_info "Stopping and removing lager containers..."
|
|
1343
|
+
# Scoped to the containers this deployment owns (lager, pigpio, and the
|
|
1344
|
+
# legacy controller). A box may run third-party containers alongside lager
|
|
1345
|
+
# — a management agent, a user's own services — and removing containers we
|
|
1346
|
+
# did not create takes down infrastructure this script cannot restore.
|
|
1347
|
+
# Update restart policy first to prevent auto-restart, then force remove.
|
|
1344
1348
|
ssh $SSH_OPTS "${BOX_USER}@${BOX_IP}" "
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
docker rm -f \$(docker ps -aq) 2>/dev/null || true
|
|
1351
|
-
# Prune any leftover containers
|
|
1352
|
-
docker container prune -f 2>/dev/null || true
|
|
1349
|
+
for c in lager pigpio controller; do
|
|
1350
|
+
docker update --restart=no \$c 2>/dev/null || true
|
|
1351
|
+
docker stop \$c 2>/dev/null || true
|
|
1352
|
+
docker rm -f \$c 2>/dev/null || true
|
|
1353
|
+
done
|
|
1353
1354
|
# Wait a moment for Docker to clean up
|
|
1354
1355
|
sleep 2
|
|
1355
1356
|
" 2>/dev/null || true
|
|
1356
|
-
print_success "
|
|
1357
|
+
print_success "Lager containers cleaned up"
|
|
1357
1358
|
|
|
1358
|
-
print_info "Cleaning up Docker
|
|
1359
|
+
print_info "Cleaning up Docker build cache and dangling images..."
|
|
1359
1360
|
echo ""
|
|
1361
|
+
# Dangling-only (no -a): 'prune -af' would also delete images belonging to
|
|
1362
|
+
# third-party containers stopped at this moment, which cannot be re-pulled
|
|
1363
|
+
# by this script.
|
|
1360
1364
|
ssh $SSH_OPTS "${BOX_USER}@${BOX_IP}" "
|
|
1361
|
-
echo 'Removing
|
|
1362
|
-
docker image prune -
|
|
1365
|
+
echo 'Removing dangling Docker images...'
|
|
1366
|
+
docker image prune -f 2>/dev/null || true
|
|
1363
1367
|
echo 'Removing Docker build cache...'
|
|
1364
1368
|
docker builder prune -af 2>/dev/null || true
|
|
1365
1369
|
echo 'Cleanup complete'
|
|
1366
1370
|
" 2>/dev/null || true
|
|
1367
1371
|
echo ""
|
|
1368
|
-
print_success "Docker
|
|
1372
|
+
print_success "Docker build cache and dangling images cleaned up"
|
|
1369
1373
|
|
|
1370
1374
|
print_info "Checking available disk space..."
|
|
1371
1375
|
ssh $SSH_OPTS "${BOX_USER}@${BOX_IP}" "df -h / | tail -n 1 | awk '{print \"Available: \" \$4 \" (\" \$5 \" used)\"}'" 2>/dev/null || true
|
|
@@ -99,6 +99,27 @@ def _token_expires_at(access_token):
|
|
|
99
99
|
return 0.0
|
|
100
100
|
|
|
101
101
|
|
|
102
|
+
def _refresh_margin(access_token):
|
|
103
|
+
"""Refresh-ahead margin, capped at a quarter of the token's lifetime.
|
|
104
|
+
|
|
105
|
+
A fixed margin at least as large as the token lifetime would classify
|
|
106
|
+
every freshly issued token as already stale, turning each request into
|
|
107
|
+
a refresh round-trip — a refresh storm against servers issuing
|
|
108
|
+
short-lived tokens, with each refresh rotating the refresh-token
|
|
109
|
+
family and multiplying the chances of losing the session.
|
|
110
|
+
"""
|
|
111
|
+
try:
|
|
112
|
+
payload_b64 = access_token.split('.')[1]
|
|
113
|
+
payload_b64 += '=' * (-len(payload_b64) % 4)
|
|
114
|
+
payload = json.loads(base64.urlsafe_b64decode(payload_b64))
|
|
115
|
+
lifetime = float(payload['exp']) - float(payload['iat'])
|
|
116
|
+
except (IndexError, KeyError, ValueError, TypeError):
|
|
117
|
+
return EXPIRY_MARGIN_SECONDS
|
|
118
|
+
if lifetime <= 0:
|
|
119
|
+
return EXPIRY_MARGIN_SECONDS
|
|
120
|
+
return min(EXPIRY_MARGIN_SECONDS, max(lifetime / 4.0, 1.0))
|
|
121
|
+
|
|
122
|
+
|
|
102
123
|
def save_login(url, access_token, cookies):
|
|
103
124
|
"""Store a session: the bearer token plus whatever cookies the auth
|
|
104
125
|
server set at login (typically an httpOnly refresh token)."""
|
|
@@ -121,20 +142,35 @@ def clear_login(url=None):
|
|
|
121
142
|
|
|
122
143
|
|
|
123
144
|
def _refresh_access_token(url, entry):
|
|
124
|
-
"""Ask the auth server for a fresh access token, or return None.
|
|
145
|
+
"""Ask the auth server for a fresh access token, or return None.
|
|
146
|
+
|
|
147
|
+
Retries once, but ONLY when the request never reached the server
|
|
148
|
+
(connection error): the server rotates the refresh token on every
|
|
149
|
+
successful refresh, so replaying the request after an ambiguous
|
|
150
|
+
failure (e.g. a read timeout) could trip the server's replay
|
|
151
|
+
detection and burn the whole session.
|
|
152
|
+
"""
|
|
125
153
|
cookies = entry.get('cookies') or {}
|
|
126
154
|
if not cookies:
|
|
127
155
|
return None
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
156
|
+
resp = None
|
|
157
|
+
for _ in range(2):
|
|
158
|
+
try:
|
|
159
|
+
resp = requests.post(
|
|
160
|
+
f'{url}/api/auth/refresh',
|
|
161
|
+
cookies=cookies,
|
|
162
|
+
timeout=AUTH_SERVER_TIMEOUT,
|
|
163
|
+
)
|
|
164
|
+
break
|
|
165
|
+
except requests.ConnectionError:
|
|
166
|
+
continue
|
|
167
|
+
except requests.RequestException:
|
|
135
168
|
return None
|
|
169
|
+
if resp is None or resp.status_code != 200:
|
|
170
|
+
return None
|
|
171
|
+
try:
|
|
136
172
|
access_token = resp.json().get('accessToken')
|
|
137
|
-
except
|
|
173
|
+
except ValueError:
|
|
138
174
|
return None
|
|
139
175
|
if not access_token:
|
|
140
176
|
return None
|
|
@@ -145,14 +181,26 @@ def _refresh_access_token(url, entry):
|
|
|
145
181
|
|
|
146
182
|
|
|
147
183
|
def access_token_for(url):
|
|
148
|
-
"""Stored access token for an auth server, refreshed if near expiry.
|
|
184
|
+
"""Stored access token for an auth server, refreshed if near expiry.
|
|
185
|
+
|
|
186
|
+
A failed refresh is not immediately fatal: if the stored token has not
|
|
187
|
+
actually expired, return it anyway and let the gateway judge it — a
|
|
188
|
+
transient auth-server error should not fail a command whose token is
|
|
189
|
+
still valid.
|
|
190
|
+
"""
|
|
149
191
|
entry = _load_store().get('authServers', {}).get(url)
|
|
150
192
|
if not entry:
|
|
151
193
|
return None
|
|
152
194
|
access_token = entry.get('accessToken')
|
|
153
|
-
|
|
195
|
+
now = time.time()
|
|
196
|
+
if access_token and _token_expires_at(access_token) > now + _refresh_margin(access_token):
|
|
197
|
+
return access_token
|
|
198
|
+
refreshed = _refresh_access_token(url, entry)
|
|
199
|
+
if refreshed:
|
|
200
|
+
return refreshed
|
|
201
|
+
if access_token and _token_expires_at(access_token) > now:
|
|
154
202
|
return access_token
|
|
155
|
-
return
|
|
203
|
+
return None
|
|
156
204
|
|
|
157
205
|
|
|
158
206
|
def auth_headers_for_box(box_ip):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|