From 2e958a6182af4d0759b4e466f53107a385d8e348 Mon Sep 17 00:00:00 2001 From: CamDavidsonPilon Date: Thu, 12 Sep 2024 16:45:04 -0400 Subject: [PATCH] fix pio version and update script --- pioreactor/cli/pio.py | 21 ++++++++++----------- update_scripts/upcoming/update.sh | 3 ++- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pioreactor/cli/pio.py b/pioreactor/cli/pio.py index f49ab0b2..67f96ba3 100644 --- a/pioreactor/cli/pio.py +++ b/pioreactor/cli/pio.py @@ -24,7 +24,7 @@ from pioreactor.logging import create_logger from pioreactor.mureq import get from pioreactor.mureq import HTTPException -from pioreactor.pubsub import get_from_leader +from pioreactor.pubsub import get_from from pioreactor.utils import JobManager from pioreactor.utils import local_intermittent_storage from pioreactor.utils import local_persistant_storage @@ -172,7 +172,7 @@ def version(verbose: bool) -> None: from pioreactor.version import rpi_version_info from pioreactor.whoami import get_pioreactor_model_and_version - click.echo(f"Pioreactor software: {tuple_to_text(software_version_info)}") + click.echo(f"Pioreactor app: {tuple_to_text(software_version_info)}") click.echo(f"Pioreactor HAT: {tuple_to_text(hardware_version_info)}") click.echo(f"Pioreactor firmware: {tuple_to_text(get_firmware_version())}") click.echo(f"Model name: {get_pioreactor_model_and_version()}") @@ -180,15 +180,14 @@ def version(verbose: bool) -> None: click.echo(f"Operating system: {platform.platform()}") click.echo(f"Raspberry Pi: {rpi_version_info}") click.echo(f"Image version: {whoami.get_image_git_hash()}") - if whoami.am_I_leader(): - try: - result = get_from_leader("api/versions/ui") - result.raise_for_status() - ui_version = result.body.decode() - except Exception: - ui_version = "" - - click.echo(f"Pioreactor UI: {ui_version}") + try: + result = get_from("localhost", "/unit_api/versions/ui") + result.raise_for_status() + ui_version = result.body.decode() + except Exception: + ui_version = "" + + click.echo(f"Pioreactor UI: {ui_version}") else: click.echo(pioreactor.__version__) diff --git a/update_scripts/upcoming/update.sh b/update_scripts/upcoming/update.sh index e8ff4a01..42f66b13 100644 --- a/update_scripts/upcoming/update.sh +++ b/update_scripts/upcoming/update.sh @@ -10,6 +10,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" UI_FOLDER=/var/www/pioreactorui SYSTEMD_DIR=/lib/systemd/system/ UI_TAG="TODO" # TODO +PIO_DIR="/home/pioreactor/.pioreactor" HOSTNAME=$(hostname) @@ -94,4 +95,4 @@ fi # test services huey_consumer -h lighttpd -h -flask --help \ No newline at end of file +flask --help